First we need imagemagick. Install it using following command:

$ sudo apt-get install imagemagick

Following commands convert the rgb pdf file  to cmyk

1. Check whether the final.pdf is rgb or cmyk

$ identify -verbose ‘final.pdf’

It displayes the many properties. Check colorspace: rgb /cmyk


If it displayes cmyk, then its ok. Otherwise need to convert into cmyk

2. To convert rbg to cmyk use following command:

$ gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite -sColorConversionStrategy=CMYK -dProcessColorModel=/DeviceCMYK -sOutputFile=output.pdf input.pdf

NOTE:- input.pdf = your_file_name.pdf
output.pdf = output_pdf_file.pdf

It displays the following output:


Replace the input.pdf with your test pdf file

3. Now again check the properties of pdf file by following command:

$ identify -verbose 'test.pdf'

It displays the following output: