Reputation: 5359
I want to change the postscript background color from white to black, and this is the ps file:
%%Page: 1 1
%%BeginPageSetup
%%PageOrientation: Landscape
pdfStartPage
0 0 540 720 re W
%%EndPageSetup
[] 0 d
1 i
0 j
0 J
10 M
1 w
/DeviceGray {} cs
[0] sc
/DeviceGray {} CS
[0] SC
false op
false OP
{} settransfer
q
q
1 i
0 0 540 720 re
W*
0 0.03 540 720 re
W
/DeviceRGB {} cs
[0 0 0] sc
[1 1 1] sc // it means [R G B] (range: from 0.0 to 1.0)
... e.g. if it is changed to [0.5 0.5 0.5]
, then the background color is grey
At the last two lines, they're totally the same; only the last line can change the background color, but the second last line can't. Why?
Upvotes: 2
Views: 2605
Reputation: 31199
Well what you have there is only part of a PostScript program. It looks to me like its been converted from a PDF file, because the operators are PDF operators, not PostScript ones. Also 'pdfStartPage' is a bit of a giveaway.
PostScript has no concept of a 'background colour'. There are portions of the page which are marked, and portions which are unmarked, that doesn't make them 'white' though, it makes them unmarked. Viewers will normally render unmarked portions as white, but that's not quite the same thing. Rendering to white (ie 0 setgray 1 1 1 setrgbcolor or 0 0 0 0 setcmykcolor) will cause a printer not to print those areas. If you actually want to write white ink then you need to use a Separation colour named /White.
If you put a piece of paper into a laser printer, and print to it, only the marked areas will be printed. If your paper is white then the unmarked areas will be white. If your paper is (for example) yellow, then the unmarked areas will be yellow.
Anyway, its not really possible to comment on what your PostScript program is doing without seeing all of it, since it redefines operators.
The two lines you have marked do not change the 'background colour', they change the current colour. Any operations after that point will be in the new current colour. Again, its impossible to say what is changed since you haven't quoted any marking operations following that point.
If you really want to discuss the program, it would be best to post it somewhere public so people can look at the entirety of the program, not just a random small chunk.
Upvotes: 4