Converting PDF without any images to CMYK

谁都会走 提交于 2020-02-12 05:27:05

问题


I read this post about how to convert PDF to CMYK, but when I try the accepted solution

gs \
    -o test-cmyk.pdf \
    -sDEVICE=pdfwrite \
    -sProcessColorModel=DeviceCMYK \
    -sColorConversionStrategy=CMYK \
    -sColorConversionStrategyForImages=CMYK \
    test.pdf

I does not get a pdf with CMYK color space, if my original pdf does not contain an image. If I add an image to it, I get the right result (checked with identify).

For example, if I create a svg with inskcape with one rectangle, export it to pdf, and then use the ghostscript command, it still gets a pdf in sRBG color space. But, if I add an image in my svg, it works fine.

What is the right option in gs to deal with that problem? My version is 9.19.


Edit: KenS found the problem: the report from identify is wrong. So I add my installed version number of ImageMagick: 6.9.3.


回答1:


If you are using an up to date version of Ghostscript, then you do not need either -sColorConversionStrategyForImages (incidentally that's not a real Ghostscript control) nor -sProcessColorModel. If you are not using an up to date version of Ghostscript, then update....

Other than that, since you haven't provided an example, or told us which version of GS you are using, or on which platform, its not really possible to say anything further.

[added after file provided]

Your original PDF file contains this as the content stream for the page:

stream
q
0 0 0 rg /a0 gs
109.715 637.714 262.855 -260.57 re f
Q
endstream

So that saves the graphcis state, sets the colour to 0,0,0 RGB, sets up a particular graphics state where the alpha is 1, draws a rectangle, and fills it with the current colour then restores the graphics state.

I then used this command line:

./gs -sDEVICE=pdfwrite -sOutputFile=CMYK.pdf -sColorConversionStrategy=CMYK test.pdf

The resulting PDF file has this as the page content stream:

stream
q 0.1 0 0 0.1 0 0 cm
/R7 gs
0.722 0.675 0.671 0.882 k
1097.15 3771.44 2628.55 2605.7 re
f
Q
endstream

So that saves the graphics state, multiples the CTM by 0.1 in x and y, sets a specific graphics state, sets the colour to 0.722, 0.675, 0.671, 0.882 CMYK, creates a rectangle, fills it with the current colour and the restores the graphics state.

So the resulting PDF file has all the colours defined as CMYK values.

Perhaps your problem is with identify not Ghostscript.



来源:https://stackoverflow.com/questions/36328722/converting-pdf-without-any-images-to-cmyk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!