一、问题说明
报错信息:org.apache.pdfbox.contentstream.PDFStreamEngine.operatorException(PDFStreamEngine.java:917) - Cannot read JBIG2 image: jbig2-imageio is not installed
相关环境信息:
在调用PDFRenderer的renderImageWithDPI(int pageIndex, float dpi)方法时报错
PDFRenderer用的是pdfbox,pom坐标为:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.19</version>
</dependency>
二、解决方案
添加以下pom依赖即可
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>jbig2-imageio</artifactId>
<version>3.0.2</version>
</dependency>
参考链接:
https://blog.csdn.net/chengzuo875963/article/details/100913781(这个链接参考过,试了发现没效果,最后通过google找到下面这个链接的方案)
https://github.com/levigo/jbig2-imageio/issues/54