Hi
all,
I tried to convert a
tiff to pdf using itext.1.4.2. I got an ArrayOutOfBounds exception in the
writeString method in the TIFFLZWDecoder.
I tried to open the
tiff in several imaging programs (gimp, ms office imaging) and they displayed
the image without complaining.
After searches on
the mailing list I found a post back in 2003 with someone with the same problem.
This person proposed a patch and it was answered it would be
included.
Apparently, it
didn't make it or there was a regression in itext (?).
I adapted the patch
to itext 1.4.2:
/**
*
Write out the string just uncompressed.
*/
public void
writeString(byte string[]) {
// Fix for broken tiff files
int max = uncompData.length-dstIndex;
if
(string.length<max)
max = string.length;
for (int
i=0; i<max; i++) {
uncompData[dstIndex++] =
string[i];
}
}
And now it
works...
Even if the
tiff files are broken, it appears that broken files are correctly handled by
other image readers. Even if this is not pretty and funny, I think itext could
benefit from this patch.
And thank you for
this very usefull library !
Regards,
Olivier
C.