I am working with a set of tiffs, several of which are invalid.
When reading into iText, I get the following error message:
Invalid TIFF -- Invalid code encountered while decoding 2D group 4
compressed data.
iText version = 2.02

My question is regarding the cause of the issue and some possible
approaches to fixing it.

Windows Picture and Fax Viewer, and Microsoft Paint can both read and
render the invalid tiffs, but iText always errors out.
In the iText code, I was able to fix the error by modifying the iText
method:
com.lowagie.text.pdf.codec.TIFFFaxDecoder.decodeT6()

Where there is an if/else block within a loop that checks the code to
decide if something is horizontal (code=1), vertical (codes = 2-8), pass
(code=0), or extension (code = 11), I am getting a code of 10.

iText libraries throw the exception "Invalid TIFF -- Invalid code
encountered while decoding 2D group 4 compressed data." in that case.  I
hacked the code to instead do the following in the unknown code block to
treat the invalid code as a line-break.  Which renders the Tiff in iText
the same way that the as the Microsoft viewers do.
bitOffset = w;
updatePointer(7 - bits);

Questions:
1) Is the 10-code linebreak a valid extension to the T-6 spec?
2) How would one go about "fixing" the tiff data to be iText friendly?
        Removing the bad codes and inserting enough horizontal white
pixels to end the line?
3) Is there a later release of iText that addresses the invalid tiff
question?

Thanks,
  -Micah


Micah Tessler
Consulting Architect
Ford Credit Enterprise Architecture
(313) 322-4267
[EMAIL PROTECTED]

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to