0

I use (Lua)LaTeX to create a PDF for printing. The color workflow is not well-managed: The PDF contains CMYK-colored LaTeX elements, PDF figures created in Inkscape, and RGB photos. ImageMagick's identify tool reveals that all pages are in the sRGB color space (which may or may not be significant). Lacking Adobe software and its Preflight feature, I tried to use GhostScript to convert my PDF file. A print shop is likely to provide a certain ICC profile for the colors that the PDF will need to be compliant with. So, having read up on color management in GhostScript and some related questions here, I came up with the following script using GhostScript 10.01.1 (on Windows 10 64-bit):

gswin64c ^
  -o "output.pdf" ^
  -sDEVICE=pdfwrite ^
  -dAutoRotatePages=/None ^
  -dRenderIntent=0 ^
  -sOutputICCProfile=ISOcoated_v2_bas.ICC ^
  "input.pdf"

The call fails with undefined in .putdeviceprops and a stack of .putdeviceprops --nostringval-- unknownerror. Being fairly new to the GhostScript world, online research would not yield reasonable results without having to dive into implementation details of GhostScript. So, troubleshooting revealed that the -sOutputICCProfile line is the problematic one, although it seemed to be the straighforward option. Using another profile yields the same error.

If I use the (apparently deprecated) option -sColorConversionStrategy=CMYK instead, GhostScript runs and produces a PDF in CMYK with color separation (according to ImageMagick's identify), but some and especially green-ish colors in the PDF are far off the intended color. This cannot be a solution anyway since, as said, I have to use whatever ICC profile will be given to me.

So here are the questions: Is it true that GhostScript converts the PDF colors to a perceptual space (i.e., CIE), and then to the output profile? Why is the -sOutputICCProfile breaking the call? How can I get GhostScript to use a certain ICC profile for the converted PDF?

Also, this is just the beginning of what I'm trying to accomplish. If the print shop would require the file to be PDF-X compliant, would I need to alter how the color space is ensured?

hschmauder
  • 308
  • 1
  • 9
  • 1
    " Is it true that GhostScript converts the PDF colors to a perceptual space (i.e., CIE), and then to the output profile?" No. The pdfwrite device goes to some lengths to make the output the same as the input. The -sOutputICCProfile only has effect on rendering devices and pdfwrite is not a rendering device. I don't know where you got the idea the ColorConversionStrategy is deprecated; it is **not**. If you want to produce colour managed output then you need to use that switch **and** supply the ICC profile as the DefaultCMYK profile to pdfwrite. – KenS May 28 '23 at 08:00
  • The pdfwrite device can produce PDF/X-3 files https://ghostscript.readthedocs.io/en/gs10.0.0/VectorDevices.html#creating-a-pdf-x-3-document. Ignore the ProcessColorModel (I need to get the docs updated there). – KenS May 28 '23 at 08:03
  • An alternative is to use the pdfimage operators, which will render the content to an image, obeying all the colour management stuff you reference (which pdfwrite ignores) and produce a final PDF file containing the image. Of course it will be large and unscalable, but it will be colour managed. – KenS May 28 '23 at 09:16

0 Answers0