itext-questions  

Re: [iText-questions] Tiff to pdf conversion - CCITT Fax Group4compression

Jamal Mohideen
Thu, 15 May 2008 11:24:16 -0700

Dear Bill,


When you run this Tiff2Pdf tool for a single file it is working fine.
But the same is failing when I am converting 1000 tiff files into 1000 PDF 
files. And also, the failure is random, in the first I got 60 tiffs 
cancelled and second time it is 964 tiffs.

How the random failure is happening? it is very strange. Does anyone have 
any clue?

Thanks and Regards,
Jamal Mohideen

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: "Post all your questions about iText here" 
<itext-questions@lists.sourceforge.net>
Sent: Thursday, May 15, 2008 5:06 PM
Subject: Re: [iText-questions] Tiff to pdf conversion - CCITT Fax 
Group4compression


> Jamal,
>
> I suspect the code you posted is not the same as the code that gave you 
> the error messages.
>
> I made the following changes to your code, then compiled and ran it, 
> getting the runtime exception I've appended to the code changes.
>
> // String oSFile = "C:/var/opt/image_migration/testnull/dnum_test.pdf";
> String oSFile = "dnum_test.pdf";
>
> // String contentsImageFile = 
> "C:/var/opt/isiv_migratie/d004/d878/d630/1.tif";
> String contentsImageFile = "d382-1.tif";
>
> Here's the runtime exception I get with yor compiled code:
>
> Exception in thread "main" java.lang.RuntimeException: The document is not 
> open.
>
>        at com.lowagie.text.pdf.PdfWriter.getDirectContent(Unknown Source)
>        at TesTiffTOtPdf.main(TesTiffTOtPdf.java:29)
>
> Note: Line 29 in the above message is the one that is
>
> PdfContentByte  cb = writer.getDirectContent();
>
> Have you tried running your TIFF files through the iText Toolbox Tiff2Pdf 
> tool on both Windows and Linux? I'd suggest you try that, and then compare 
> your code with the source code for Tiff2Pdf to see where you're going 
> wrong.
>
> Best regards,
> Bill Segraves
> -------------- Original message ----------------------
> From: "Jamal Mohideen" <[EMAIL PROTECTED]>
>>
>> Dear Bill,
>>
>> We have started with iText2.0.7 last year, now changed the lib to itext
>> 2.1.0.
>> I have now attached the compilable source code used for my conversion. If
>> you feel something is wrong, please provide your code to me.
>> Between, the conversion is always 100% success for the tiff files, but 
>> the
>> same set programs, jars and input files, it is failing in Linux.
>>
>> I have attached the tiff again for your reference.
>>
>> Exception message is :
>> -----------------------------
>> java.lang.RuntimeException: Invalid code encountered while decoding 2D 
>> group
>> 4 compressed data.
>>  at
>> com.lowagie.text.pdf.codec.TIFFFaxDecoder.decodeT6(TIFFFaxDecoder.java:1042)
>>  at com.lowagie.text.pdf.codec.TiffImage.getTiffImage(TiffImage.java:272)
>>  at com.lowagie.text.pdf.codec.TiffImage.getTiffImage(TiffImage.java:117)
>>  at
>> colruyt.tifftopdfliblocal.service.bl.iTextPdfConvService.convertTifToPDF(iTextPd
>> fConvService.java:558)
>>  at
>> colruyt.tifftopdfliblocal.service.bl.iTextPdfConvService.generateMultiplePagesPD
>> F(iTextPdfConvService.java:280)
>>  at
>> colruyt.tifftopdfliblocal.service.bl.iTextPdfConvService.createPdfDocument(iText
>> PdfConvService.java:74)
>>  at
>> colruyt.tifftopdfliblocal.service.bl.PdfConversionService.createPdfDocument(PdfC
>> onversionService.java:56)
>>  at
>> colruyt.tifftopdfliblocal.service.bl.iTextBackground.create(iTextBackground.java
>> :271)
>>  at
>> colruyt.tifftopdfliblocal.service.bl.iTextBackground.executeRequest(iTextBackgro
>> und.java:76)
>>  at
>> colruyt.tifftopdfliblocal.service.bl.iTextBackground.execute(iTextBackground.jav
>> a:53)
>>  at
>> colruyt.baseframelib.background.AbstractBackground.runExecute(AbstractBackground
>> .java:612)
>>  at
>> colruyt.baseframelib.background.AbstractBackground.run(AbstractBackground.java:4
>> 93)
>>  at java.lang.Thread.run(Thread.java:832)
>> -----------------------------
>>
>> Thanks and Regards,
>> Jamal Mohideen
>> ----- Original Message ----- 
>> From: <[EMAIL PROTECTED]>
>> To: "Post all your questions about iText here"
>> <itext-questions@lists.sourceforge.net>
>> Sent: Wednesday, May 14, 2008 7:11 PM
>> Subject: Re: [iText-questions] Tiff to pdf conversion - CCITT Fax Group
>> 4compression
>>
>>
>> > Jamal,
>> >
>> > Please see inline responses below.
>> >
>> > Best regards,
>> > Bill Segraves
>> >
>> > P.S. FYI, this is a discussion list, not a help desk, so your prioriies
>> > may not be the same as those of other participants. Use of "High 
>> > Priority"
>> > is disrespectful of other participants, as it shows you may have little 
>> > or
>> > no respect for *their* priorities.
>> > -------------- Original message ----------------------
>> > From: "Jamal Mohideen" <[EMAIL PROTECTED]>
>> >>
>> >> Hi There,
>> >>
>> >> We are facing problem in converting some tiff files to PDF, 
>> >> specifically
>> >> CCITT
>> >> Fax group 4 compression type files.
>> >>
>> >> These tiff's are always failing with the method call
>> >> "TiffImage.getTiffImage(ra, c + 1);" in Linux environment.
>> >>
>> >> but when we use the direct read option "TiffImage.getTiffImage(ra, c + 
>> >> 1,
>> >> true);", then the conversion generating invalid pdf files (image in 
>> >> pdf
>> >> is not
>> >> viewable, probably corrupted).
>> >>
>> >> I have attached the input tiff files and respective PDF generated from
>> >> the
>> >> program. FYI, multiple are added into single PDF file.
>> >>
>> >
>> > FYI, the PDF you posted is not viewable in Adobe Reader 8.1.2. It does
>> > show the correct number of pages, but it displays no content.
>> >
>> > The program you posted should not be expected to work on either Windows 
>> > or
>> > Linux, as it is not a complete program, i.e., it throws 11 errors when 
>> > I
>> > compile it on Windows. You are supposed to post a small, but complete,
>> > program that demonstrates/exhibits your problem.
>> >
>> >> PDF file Image_D435.pdf generated using d435-*.tif and PDF file
>> >> Image_D382.pdf
>> >> generated using d382-*.tif
>> >>
>> >
>> > Your input files work fine with my program, ScaleAndTile3, when I use 
>> > it
>> > to convert your TIFF files to PDF files. The TIFF conversion in my 
>> > program
>> > is similar to that of the Tiff2Pdf tool in the iText Toolbox.
>> >
>> > You might try using the Tiff2Pdf tool in the Toolbox to see if it 
>> > exhibits
>> > the same problems you have with Linux.
>> >
>> >> The conversion is always success when I convert these tiff files in
>> >> Windows
>> >> (Development PC Windows XP SP2), the problem is appearing when running 
>> >> in
>> >> Linux.
>> >>
>> >> Part of Java code used for pdf conversion has been attached with this
>> >> email.
>> >>
>> >
>> > I see you're using methods from iText 2.1.0 and up that are 
>> > replacements
>> > for (old) methods that were deprecated in the iText 2.0.7 that you used 
>> > to
>> > generate your example PDF. Have you checked the iText JAR file for your
>> > Linux installation to see that you're using a compatible version, i.e.,
>> > one that has the new methods?
>> >
>> >> Could you please look into the tiff and provide your feedback.
>> >>
>> >
>> > If you'll post the 4-page TIFF file that's causing your problem, I'll 
>> > be
>> > glad to run it through my program to see if it's compatible.
>> >
>> >>
>> >> Thanks and Regards,
>> >> Jamal Mohideen
>> >
>> > P.S. Just curious. Why are you using iText 2.0.7?
>> >
>> >
>> >
>> >
>> > -------------------------------------------------------------------------
>> > This SF.net email is sponsored by: Microsoft
>> > Defy all challenges. Microsoft(R) Visual Studio 2008.
>> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> > _______________________________________________
>> > iText-questions mailing list
>> > iText-questions@lists.sourceforge.net
>> > 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
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> 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 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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