I've noticed that the following command does not throw an error: > gswin64c -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sColorConversionStrategy=foofoofoo -sColorConversionStrategyForImages=barbarbar -sOutputFile=inp.pdf out.pdf The `-dColorConversionStrategy=/DeviceCMYK` is yet another example. The processing finishes without any error or warning, but nothing is converted. This might be misleading, and make typos very dangerous. As a user, I expect that an error would be thrown when an argument value turns out to be invalid. The issue does not seem to depend on a specific pdf.
The genuine parameter error now throws an error with this commit: 1f30baee070ea9da1de1cb479e3a5c49c0514267 Note that there is no valid switch 'ColorConversionStrategyForImages', so this will not throw an error. Unrecognised command line switches don't, for PostScript, because a way of passing parameters to PostScript programs is to set the values on the command line. So just because we don't recognise a switch as a device parameter doesn't mean its invalid. If you were to use the setdistillerparams operator, instead of setting command line parameters, then I think it would throw an error because there is no such distiller parameter.
(In reply to Ken Sharp from comment #1) > now throws an error Great, thanks! > Note that there is no valid switch 'ColorConversionStrategyForImages' Wow. That seem to be an quite popular fake switch. Just for reference, I've added a corresponding comments to some occurrences I've found: * https://softwarerecs.stackexchange.com/questions/18442/command-line-pdf-image-compression-optimizer/56889#comment78510_18459 * https://unix.stackexchange.com/questions/93959/how-to-convert-a-color-pdf-to-black-white#comment936901_185819 * https://stackoverflow.com/questions/2297327/tool-for-pdf-conversion-to-black-and-white/9285931#comment97233961_9285931 * https://stackoverflow.com/questions/24615094/how-to-batch-convert-cmyk-pdfs-to-rgb/27464515#comment97234004_27464515 * https://stackoverflow.com/questions/20399713/ghostscript-outputs-blank-pdf/20421260#comment97234447_20421260 > If you were to use the setdistillerparams operator, instead of setting > command line parameters, then I think it would throw an error because > there is no such distiller parameter. Hm, for me, it does not seem to throw an error, e.g. starting from the following conversion (that works _almost_ like normal): > gswin64c -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -q -sOutputFile=%1_v20.pdf -c "<</ColorConversionStrategy /CMYK>> setdistillerparams" -f %1.pdf I add few more switches, and it still works without complains: > gswin64c -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -q -sOutputFile=%1_v20.pdf -c "<</ColorConversionStrategy /CMYK /ColorConversionStrategyForImages /CMYK /foofoo /barbar>> setdistillerparams" -f %1.pdf
Just for reference: Yes, it turns out that `setdistillerparams` ignores unknown switches too, and this is normal behavior, see https://ghostscript.com/irclogs/2019/03/20.html