The problem is that no decompressed data is returned in JBIG2Filter.java by:

BufferedImage bi = ImageIO.read( compressedData );

bi is always null, so there is no error condition, but also no work done. It seems to me that decompressing JBIG2 is more complicated than passing the compressedData to imagio. Thereis a good amount of data at COSDictionary options, namely:

COSDictionary{(COSName{ColorSpace}:COSName{DeviceGray}) (COSName{Subtype}:COSName{Image}) (COSName{Filter}:COSName{JBIG2Decode}) (COSName{Length}:COSInt{32219}) (COSName{Width}:COSInt{2840}) (COSName{Type}:COSName{XObject}) (COSName{BitsPerComponent}:COSInt{1}) (COSName{Height}:COSInt{3658}) } filterIndex: 0

and I suspect the decoder needs this data to perform properly. A cursory look at http://www.verypdf.com/document/pdf-format-reference/pg_0080.htm also influences my opinion.

-KB



On Thu, 3 Feb 2011, Kenneth Berland wrote:

Yes, I did. I confirm this by placing the following code in JBIG2Filter.java:

for ( int idx=0; idx < myStringArray.length; idx++){
 System.out.println( myStringArray[idx] );
}

This yields:

BMP
jpeg
WBMP
GIF
jpg
bmp
jbig2
JPG
wbmp
png
JBIG2
PNG
JPEG
gif

-KB


On Thu, 3 Feb 2011, Andreas Lehmkuehler wrote:

Hi,

Am 03.02.2011 02:49, schrieb Kenneth Berland:
Andreas,

I can't make pdfbox decompress jbig2 encoding images anymore. Do you have a
sample pdf and java code that works?

I had it working in September when I submitted the patch,
https://issues.apache.org/jira/browse/PDFBOX-81, but, for the life of me, I don't know what has changed. I've tried with pdfbox-1.4.0 and my patches to
1.2.1. I'm thinking that my sample file is bad?
Did you add the ImageIO-plugin [1] to yout classpath?

BR
Andreas Lehmkühler

P.S.: Please use the mailing lists to discuss PDFBox topics.

[1] http://code.google.com/p/jbig2-imageio/

Reply via email to