org.apache.pdfbox.pdmodel.PDDocument 不加载/读取 PDF 文档 [英] org.apache.pdfbox.pdmodel.PDDocument does not load / read the PDF document

查看:181
本文介绍了org.apache.pdfbox.pdmodel.PDDocument 不加载/读取 PDF 文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个简单的java程序来获取PDF文档的页码.这适用于我的大多数文档,但不适用于这个:

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

代码片段如下:

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

其中 docPath 指向本文档的本地路径.

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

然后程序在这里停止.它不会退出,也不会打印任何错误消息.它只是在 PDDocument.load() 处停止并且不会继续.

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.

推荐答案

我遇到了同样的问题,所以我使用您提到的 PDF 向 PDFBox 工作人员提出了一个问题.它位于 https://issues.apache.org/jira/browse/PDFBOX-1726.

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.

他们建议我使用 PDDocument.loadNoSeq() 而不是 PDDocument.load().它对我有用!

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

试试这个,让我们知道!

Try this and let us know!

这篇关于org.apache.pdfbox.pdmodel.PDDocument 不加载/读取 PDF 文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆