我如何获得有关 pdf 结构的信息,我的意思是文本或图片?我需要我的程序在其他文件夹中移动没有文本的 pdf,但现在我得到的只是一个空的 txt 文件。
try (FileWriter writer = new FileWriter(outputFile)) {
PDDocument document = new PDDocument().load(file);
PDFTextStripper pdfTextStripper = new PDFTextStripper();
String text = pdfTextStripper.getText(document);
writer.write(text);
document.close();
} catch (IOException e){
e.printStackTrace();
}
此外,从保存在 pdf 网页中获取文本时遇到问题。看起来像:
我认为编码有问题,但不知道该怎么办