简体   繁体   中英

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

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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM