Forget that example, iText can now read tiffs natively just like any other format. This will give you only the first page. To read more than one page see the example read_tiffs.java at http://prdownloads.sourceforge.net/itextpdf/examples-133.zip.
Best Regards, Paulo Soares ----- Original Message ----- From: "Mark Hanson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, August 11, 2004 22:53 Subject: [iText-questions] Insufficient data error in Adobe > > > Hello, > > We have an appliation where we are needing to read TIFs from the database and > then convert them to PDF's. For almost all of the TIF's we've tried so far > we've had very good success converting. But for some of them, we end up > getting a pdf file created that is much smaller than the real TIF size and when > we open the file in Adobe we get an "Insufficient data" error and nothing shows > up. > > We used the Chap0612 example from the iText web site, and I think that the key > is the file size that is found from this line: > > long size = dir.getFieldAsLong(TIFFImageDecoder.TIFF_STRIP_BYTE_COUNTS); > > which is used to read the data into the SeekableStream: > > byte im[] = new byte[(int)i]; > s.seek(offset); > s.readFully(im); > > This TIF file is getting processed correctly using a VB application that we > have but I don't have the code for and also was processed correctly using > Tiff2Pdf. We are wanting to use iText.jar because we are not wanting to write > any files (tif or pdf) to our system just store them in the user's session as > ByteArrayOutputStream's and then render to the user when ready. > > Here are the dimensions of a unsuccessfully processed tif: > > file length = 29088 > IFDOffset = 80 > h = 2199 w = 1760 offset = 816 size = 393 compression = 4 > > and an successful one: > > file length = 33058 > IFDOffset = 8 > h = 2196 w = 1696 offset = 520 size = 32538 compression = 4 > > Can anyone give a reason why the size of the TIFF_STRIP_BYTE_COUNTS is so > different than the size of the file in the unsuccessfully converted case? Are > there any workarounds? > > Thanks for your help, > Mark > > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > iText-questions mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/itext-questions ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
