Good evening list!

This problem might not have anything to do with Itext as such. It's mostly a cry out to see if anyone on this list have an idea for a solution to my problem. I hope that is okay.

My problem then, is this: I extract images from PDF documents using Itext. Sometimes, this is a JPEG/JFIF image. (I treat any image with a DCTDecode filter as a JPEG. Is that incorrect?) I then convert extracted images into TIFF and perform some image processing before they are turned back into their internal PDF format, e.g. JPEG or raw CMYK etc.. The image format conversions are made with the ImageMagick API.

I then proceed to replace the data of the images in the PDF with the data of the images that has gone through conversion and image processing. For this I use the setData() method in the PRStream object of the images I find in the PDF, and a PdfStamper to write a new PDF.

The unfortunate result is that JPEG images in the new PDF document appear garbled, while other image formats I have been working with come through fine.

My premier theory to explain this is that the JPEG image generated by ImageMagick is somehow not compatible with what is standard within the PDF. So while ImageMagick can make sense out of a JPEG come from a PDF, a PDF cannot make sense out of a JPEG come from ImageMagick.

My secondary theory is that there could be some problem with how I do the replacement. Should I have to apply some filters to the data before I call the setData() method?

Obviously I have tried a whole lineup of approaches but always with the same dissapointing result. So this mail is a hope that someone out there has a clue as to what might go wrong and what one might do to stop it from doing so. If you have one such clue, please let me know of it!

Regards,

Petter Nyström


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to