3

I am currently parsing a PDF file using iText, and I encountered an image format which is not supported:

com.itextpdf.text.exceptions.UnsupportedPdfException: The filter /JPXDecode is not supported. 

It seems that the information in the raw byte array is JPEG data, without the header information, as the file command line utility indicates:

83.jpg: JPEG 2000 image data 

My first idea would be to simple add the header metadata to these files, but I simply don't know how.

How can I add the header metadata to a raw piece of JPEG 2000 data ? A solution using iText would work as well.

3
  • 1
    The PDF spec (Section 7.4.9 JPXDecode Filter) seems to imply that the byte array is already a fully fledged JPEG2000 file. Have you tried just saving the byte array out to file with .jp2 or jpx extension? Commented Feb 22, 2011 at 15:02
  • @Jimmy Aaargh. Never crossed my mind, now I can open them. Would you be so kind to add an answer with your comment so that I can accept it? Commented Feb 22, 2011 at 15:04
  • no probs - you may find other useful information in the stream dictionary for the JPX stream. Commented Feb 22, 2011 at 15:07

1 Answer 1

6

The PDF spec (Section 7.4.9 JPXDecode Filter) seems to imply that the byte array is already a fully fledged JPEG2000 file. Have you tried just saving the byte array out to file with .jp2 or jpx extension?

Sign up to request clarification or add additional context in comments.

1 Comment

Both JPEG and JPEG2000 wrapped in PDF files are fully formed files that can be written to individual files without modification. The other compression types (Flate, CCITTFax, uncompressed) are raw image data and would require additional info to be usable as stand-alone files.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.