I want to produce a postscript file that uses only RGB colors with DVIPs, but DVIPs includes color.pro which defines basic colors using CMYK values. color.pro defines setcmykcolor using setrgbcolor when it is undefined:
kreyszig wrote:
I want to produce a postscript file that uses only RGB colors with DVIPs, but DVIPs includes color.pro which defines basic colors using CMYK values. color.pro defines setcmykcolor using setrgbcolor when it is undefined:
/setcmykcolor where{pop}{/setcmykcolor{dup 10 eq{pop
setrgbcolor}{1 sub 4 1 roll 3{3 index add neg dup 0 lt{pop 0}if 3 1 roll
}repeat setrgbcolor pop}ifelse}B}ifelse
Somehow setcmykcolor is already defined though, resulting in the usage of CMYK values in the PS file. How can I prevent this from happening?
I use that already in LaTeX. What this does is to rewrite my own colors using RGB, but it does not prevent dvips from using the color.pro header file which uses CMYK. The color.pro header would work fine if setcmykcolor was undefined when I use
in a later stage to produce my PDF file, but for some reason gs defines setcmykcolor even when using DeviceRGB, so it fails at converting everything to setrgbcolor...
I use that already in LaTeX. What this does is to rewrite my own colors using RGB, but it does not prevent dvips from using the color.pro header file which uses CMYK. The color.pro header would work fine if setcmykcolor was undefined when I use
in a later stage to produce my PDF file, but for some reason gs defines setcmykcolor even when using DeviceRGB, so it fails at converting everything to setrgbcolor...
Sorry, but in color.pro is only a definition for setcmykcolor but it does
not mean that it is already used. However, you can overwrite /setcmykcolor:
\AtBeginDocument{\special{ps:
/setcmykcolor { 10 dict begin
/K exch def
/K1 1 K sub def
/Y exch def
/M exch def
/C exch def
1 C K1 mul K add sub
1 M K1 mul K add sub
1 Y K1 mul K add sub
setrgbcolor
end
} def
}}
CrazyHorse wrote:
Sorry, but in color.pro is only a definition for setcmykcolor but it does
not mean that it is already used. However, you can overwrite /setcmykcolor:
\AtBeginDocument{\special{ps:
/setcmykcolor { 10 dict begin
/K exch def
/K1 1 K sub def
/Y exch def
/M exch def
/C exch def
1 C K1 mul K add sub
1 M K1 mul K add sub
1 Y K1 mul K add sub
setrgbcolor
end
} def
}}
Herbert
Thanks for the code, this is a good idea. I had verified in the ps file that setcmykcolor was used/defined for the first time in the code read from color.pro. What I had done is to copy color.pro in my directory and load it via the DVIPSHEADERS environment variable. For now I am defining setcmykcolor using the code from the original color.pro that used to be executed only when setcmykcolor was undefined, but what I could eventually do is to simply rewrite the basic color values using RGB directly. setcmykcolor is only used to define the basic colors in my ps file (due to the usage of the xcolor pacakage with the option rgb). I still find weird that gs defines setcmykcolor when using DeviceRGB, but I guess I have a way around it now. I just need to check if Preflight is finally happy with my PDF/A...
it allows to generate a document complying with PDF/A-1b (according to Adobe Acrobat Preflight) that uses DeviceRGB. Of course you have to also include the meta information as required... I use the appropriate options in hyperref to include it...
Now that the problem seems to be solved, please be so kind and mark the topic (not the last post) accordingly as clearly written in Section 3 of the Board Rules (to be read before posting). Otherwise please tell us what is missing. Please keep that in mind for the future so that further reminders will not be necessary.