由于其中的 JBIG2 图像,PDF 框生成空白图像 [英] PDF Box generating blank images due to JBIG2 Images in it
问题描述
让我先向您介绍一下我的项目.我有一个 pdf,我需要使用 PDFBox
API 将其转换为图像(一页图像),并使用 PDFBox
API 本身将所有这些图像写入新的 pdf.基本上,就是将 pdf 转换成 pdf,我们称之为 PDF 转码.
Let me give you an overview of my project first. I have a pdf which I need to convert into images(One image for one page) using PDFBox
API and write all those images onto a new pdf using PDFBox
API itself. Basically, converting a pdf into a pdf, which we refer to as PDF Transcoding.
对于某些包含 JBIG2 图像的 pdf,convertToImage()
方法的 PDFbox 实现无声无息地失败,没有任何异常或错误,最后生成一个 PDF,但这一次,只有空白内容(白色的).我在控制台上收到的消息是:
For certain pdfs, which contain JBIG2 images, PDFbox implementation of convertToImage()
method is failing silently without any exceptions or errors and finally, producing a PDF, but this time, just with blank content(white). The message I am getting on the console is:
Dec 06, 2013 5:15:42 PM org.apache.pdfbox.filter.JBIG2Filter decode
SEVERE: Can't find an ImageIO plugin to decode the JBIG2 encoded datastream.
Dec 06, 2013 5:15:42 PM org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap getRGBImage
SEVERE: Something went wrong ... the pixelmap doesn't contain any data.
Dec 06, 2013 5:15:42 PM org.apache.pdfbox.util.operator.pagedrawer.Invoke process
WARNING: getRGBImage returned NULL
我需要知道如何解决这个问题?我们有类似的东西:
I need to know how to resolve this issue? We have something like:
import org.apache.pdfbox.filter.JBIG2Filter;
我不知道如何实现.
我正在寻找,但无济于事.有人可以建议吗?
I am searching on that, but to no avail. Could anyone please suggest?
推荐答案
在 PDFBox 中查看这张票 https://issues.apache.org/jira/browse/PDFBOX-1067.我认为您的问题的答案是:
Take a look at this ticket in PDFBox https://issues.apache.org/jira/browse/PDFBOX-1067 . I think the answer to your question is:
- 确保为您的 Java 版本安装了 JAI 和 JAI-ImageIO 插件:可在此处获得合适的安装说明:http://docs.geoserver.org/latest/en/user/production/java.html
- 要使用 JBIG2-imageio 插件,(新版本在 Apache2 许可下获得许可)https://github.com/levigo/jbig2-imageio/
这篇关于由于其中的 JBIG2 图像,PDF 框生成空白图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!