通过PDFBox渲染JBIG2Image时出错

问题描述

我开发了显示PDF的工具,所以我使用numbers = [23,76,45,71,98,23,65,37,93,21] offset = 0 while True: try: idx = numbers.index(71,offset) print(f'Found at position {idx}') offset = idx + 1 except ValueError: break 页面呈现为图像

Found at position 3
Found at position 9

为了能够渲染所有类型的图像,我添加了此依赖项,以便可以将图像显示jpeg2000jbig2

PDFBox

启动应用程序时,我将jbig2Image的SPI注册到IIORegistry

       <dependency>
            <groupId>org.apache.pdfBox</groupId>
            <artifactId>pdfBox</artifactId>
            <version>2.0.19</version>
       </dependency>

最后,我使用此代码来呈现PDF页面

       <dependency>
            <groupId>com.github.jai-imageio</groupId>
            <artifactId>jai-imageio-core</artifactId>
            <version>1.4.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.jai-imageio</groupId>
            <artifactId>jai-imageio-jpeg2000</artifactId>
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfBox</groupId>
            <artifactId>jbig2-imageio</artifactId>
            <version>3.0.2</version>
        </dependency>

根据PDFRenderer类,我正在使用最后一个JDK(JDK8_261),并使用提到的选项启动我的应用程序

enter image description here

直到这里,在我的开发工具(IntelliJ)上一切正常之后,我将我的应用程序部署在GlassFish 4.1(这是一个旧的应用程序)上

部署后,我的应用程序首先运行良好,然后使用Jbi2Image为每个PDF页面获取此异常

enter image description here

有人可以帮助我解决这个问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)