org.apache.pdfbox.pdmodel.PDDocument does not load / read the PDF document

我的梦境 提交于 2021-01-28 18:42:03

问题


I wrote a simple java program to get the page number of a PDF document. This works for most of my documents, but it does not work for this one:

http://web.itu.edu.tr/~pazarci/rtv/TEK_Digital%20Video%20Measurements_25W_14700_3.pdf

The snippet of the code is below:

    document = PDDocument.load(docPath);
    System.out.println( docPath + ": " + document.getNumberOfPages() + " pages");

in which docPath points to the local path of this document.

The program then halts here. It does not exit and does not print any error message. It just stops at PDDocument.load() and does not continue.


回答1:


I've had the same problem, so I've opened an issue to the PDFBox crew using the PDF you mentioned. It's located on https://issues.apache.org/jira/browse/PDFBOX-1726.

They advised me to use the PDDocument.loadNoSeq() instead of PDDocument.load(). It worked for me!

Try this and let us know!



来源:https://stackoverflow.com/questions/16888775/org-apache-pdfbox-pdmodel-pddocument-does-not-load-read-the-pdf-document

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!