I need to check if given PDF files are completely in CMYK color space. As you probably know, it is needed for printing.
Currently, it is done using GUI applications from Adobe, but it takes much time and we need to automate it with linux script.
I have tested many libraries, but each of them gave me invalid results or don't support newer PDF specs.
ghostscript
identify -verbose
gives invalid results (bad colorspace, but also bad DPI).As far as i know, PDF can have different color spaces for elements in document and I want to check if every element is in CMYK.
You can do this by pdfimages:
pdfimages -list filename.pdf
For a file with CMYK images, the output resembles:
page num type width height color comp bpc enc interp object ID x-ppi y-ppi size ratio
--------------------------------------------------------------------------------------------
1 0 image 5197 6732 cmyk 4 8 jpeg no 5 0 600 601 32.3M 24%
1 1 mask 5197 6732 - 1 1 jpeg no 5 0 600 601 32.3M 775%
If all the images use an ICC profile, the output resembles:
page num type width height color comp bpc enc interp object ID x-ppi y-ppi size ratio
--------------------------------------------------------------------------------------------
1 0 image 5197 6732 icc 3 8 jpeg no 8 0 600 601 7080K 6.9%
1 1 mask 5197 6732 - 1 1 jpeg no 8 0 600 601 7080K 166%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With