[英]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.