2

I have some pdf documents and I need to find a way to automate convert all the images included in the pdfs from RGB to CMYK.

I prefer to use c# as programing language. I worked in the past with iTextSharp but it doesn't allow me to do this (it doesn't or I don't know).

The question is: what should I use to extract all the images from a pdf, convert from RGB to CMYK and put all the converted images back (no other changes).

Thanks.

Zelter Ady
  • 6,266
  • 12
  • 48
  • 75
  • http://stackoverflow.com/questions/5945244/extract-image-from-pdf-using-itextsharp read this – kyjan Mar 26 '12 at 13:32

2 Answers2

0

I would find a Converter to convert your PDF to HTML and then take all the images out, convert them, update the references and then convert it back to PDF.

You can use this package to convert to HTML: http://sourceforge.net/projects/pdftohtml/

Then you can use the GDI or graphics library to convert between RGB and CMYK. Possibly look into a third party console application to do the conversion, as I am not 100% sure whether GDI can write CMYK, I only know it can read CMYK.

Hope that helps

Base33
  • 3,167
  • 2
  • 27
  • 31
  • thanks for your answer. The issue is not to convert the image to cmyk, but to extract and update the image. Because the pdf is for print, I need the extract/update process to be accurate, this means do not change something in the pdf. Because of this any convert and re-convert to pdf is not a solution in this case. – Zelter Ady Mar 26 '12 at 14:02
  • 1
    Would this help? I suppose opening the PDF and replacing images is basically what you want. ei. Export images -> modify them -> replace images with the new ones. Try this: http://forums.codeguru.com/showthread.php?t=468051 – Base33 Mar 26 '12 at 14:56
  • I would not recommend converting to HTML and back. It is very error prone. Both conversions will never be ideal. The chance of ending up with the exact PDF is low to none. – Frank Rem Mar 28 '12 at 16:16
  • Very true. You would be very lucky if it did look alike. I think if you needed it to be exact then manual would be the best option, unless adobe had an API where you can modify the PDF source directly. – Base33 Mar 28 '12 at 20:44
0

PDF files using only CMYK colorspaces are sometimes called PDF/X. If a commercial library is an option for you, you could give Amyuni PDF Converter a try. There is a web post called "Creating PDF/X-1 or PDF/X-3 with Amyuni PDF Converter" that explains the process you would need to apply: .

Usual dislcaimer applies

yms
  • 10,361
  • 3
  • 38
  • 68