Hi,
 
I've been developing with iText and i've noticed some problems with iText, a specific TIF file (found at http://wendy.verite.com/~trevor/logo.tif) was producing the following error when I tried to use: document.add(Image.getInstance("logo.tif"));
 
Exception in thread "main" ExceptionConverter: ExceptionConverter: java.lang.ArrayIndexOutOfBoundsException: 7539
        at com.lowagie.text.pdf.codec.TIFFLZWDecoder.writeString(TIFFLZWDecoder.java:176)
        at com.lowagie.text.pdf.codec.TIFFLZWDecoder.decode(TIFFLZWDecoder.java:117)
        at com.lowagie.text.pdf.codec.TiffImage.getTiffImageColor(Unknown Source)
        at com.lowagie.text.pdf.codec.TiffImage.getTiffImage(Unknown Source)
        at com.lowagie.text.pdf.codec.TiffImage.getTiffImage(Unknown Source)
        at com.lowagie.text.Image.getInstance(Unknown Source)
        at com.lowagie.text.Image.getInstance(Unknown Source)
        at Test.main(Test.java:18)
 
I was able to fix the error in what I think was a hack rather than a fix (but the image rendered, so all is well that ends well right?) I changed line com/lowagie/text/pdf/codec/TIFFLZWDecoder (176) from:
 
uncompData[dstIndex++] = string[i];
 
to:
 
if(uncompData.length > dstIndex)
    uncompData[dstIndex++] = string[i];
 
 
- Trevor

Reply via email to