Converting color PDF to B/W

An easy to forget command line

Recently I was faced with the conversion of color PDF to B/W only. This quick hack did the job:

gs -sDEVICE=psmono -dNOPAUSE -dBATCH -dNoCancel -sOutputFile=mono.ps color.pdf  
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dNoCancel -sOutputFile=mono.pdf mono.ps

I converted a batch of single page PDFs, but it should also work with multipage files.

If ghostscript complains with

Unknown device: psmono

you could try:

gs -sDEVICE=pdfwrite -sProcessColorModel=DeviceGray -sColorConversionStrategy=Gray -dOverrideICC -o mono.pdf -f color.pdf