繁体   English   中英

PDFBox:ExtractImages JPEG2000 图像未提取

[英]PDFBox: ExtractImages JPEG2000 images not extracting

我正在尝试使用 PDFBox 提取 PDF 文件中的所有图像。 它适用于包含 jpeg 和 png 图像的 pdf。 但它不适用于 OpenJPEG2000 图像。 我收到以下异常: 收到以下错误:

org.apache.pdfbox.contentstream.PDFStreamEngine operatorException
SEVERE: Cannot read JPEG2000 image: Java Advanced Imaging (JAI) Image I/O Tools are not installed

在所有版本的 PDFBox 中,都会出现相同的异常。 也尝试过独立 jar。

我也在 pom.xml 中包含了必要的依赖项。

<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>jbig2-imageio</artifactId>
</dependency>
<!-- For legal reasons (incompatible license), these two dependencies
are to be used only in the tests and may not be distributed. -->
<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-core</artifactId>
</dependency>
<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-jpeg2000</artifactId>
</dependency>

任何帮助将不胜感激。

将镜像相关的 .jar 文件复制到 lib 子目录中,然后使用以下命令行:

java -cp "pdfbox-app-2.0.21.jar;lib/*" org.apache.pdfbox.tools.PDFBox ExtractImages <parameters>

用 ”;” 在 Windows 上,“:”在 linux 上。

org.apache.pdfbox.tools.PDFBox是主类的名称。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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