-
1. Re: How to : Replace an image
lrosenth Feb 8, 2010 4:29 AM (in response to joeln3)If it is just a simple raster image (Image XObject vs. Form XObject) - then you could certainly use the Cos APIs to do the replacement of the key in the Resources dictionary of the image to the new one. (ie. CosDictPut( resDict, imageResourceName))
-
2. Re: How to : Replace an image
joeln3 Feb 8, 2010 4:34 AM (in response to lrosenth)Yes Leoanrd it's what I do.
But the problem appears with some images which are rotated (90°) sometimes when I change the XObject.
-
3. Re: How to : Replace an image
lrosenth Feb 8, 2010 5:04 AM (in response to joeln3)Perhaps you aren't taking that into account when you create your intermediate version?
-
4. Re: How to : Replace an image
joeln3 Feb 8, 2010 5:10 AM (in response to lrosenth)The TIFF is correct and the preview is also correct in my application.
1. When I create my TIFF image I use the AVConversionFromPDF with my first intermediate PDF with only my PDEImage
2. After I use the AVConversionToPDF with my TIFF and I retrieve the PDEImage
The differences between the two "intermediate" PDF files are : MediaBox and CTM. So I guess that the problem comes from this difference. But maybe not...
I tried this workflow without changing my first intermediate PDF and it works so I'm just wondering how I can create my second intermediate PDF file with the same parameters than my first one.
-
5. Re: How to : Replace an image
lrosenth Feb 8, 2010 5:13 AM (in response to joeln3)Rather than using PDEImage in the first case, what if you construct the temp PDF page yourself using Cos? What does the output image look like?
-
6. Re: How to : Replace an image
joeln3 Feb 8, 2010 6:08 AM (in response to lrosenth)Leonard,
Using the Cos to create the PDF (so with a new mediaBox and customized CTM) generates a strange output image in the PDF file. But once this image is edited and inserted in the original PDF it looks good.
I think that some PDF generators create bad images and edit them with the CTM to have a correct display(I'm sure that it's not the best way to insert image ine a PDF).
Thanks for your help.
Joe



