【发布时间】:2017-10-23 01:57:54
【问题描述】:
我正在使用pdf2dom 并尝试他们的基本文档。在他们的文档中声明 - Pdf2Dom 基于 Apache PDFBox™ 库。
File file = new File("file.pdf");
PDDocument pdf = PDDocument.load(file);
PDFDomTree parser = new PDFDomTree();
Document dom = parser.createDOM(pdf);
System.out.println(dom);
打印出来的内容 - [#document: null]
用 3 个不同的 pdf 尝试了相同的代码
当我在文本中剥离相同的 PDF 时,它会返回有效文本。因此该文件不为空。我做错了什么还是图书馆本身?
脱衣舞代码如果有帮助的话。
PDDocument pdf = PDDocument.load(pFile);
PDFTextStripper stripper = new PDFTextStripper();
String text = stripper.getText(pd);
System.out.println(text);
任何建议将不胜感激,在此先感谢。
【问题讨论】: