[pdftex] Problem with colors in included PDF file

Andreas Matthias amat at kabsi.at
Fri Jun 13 17:04:59 CEST 2003


Piet van Oostrum wrote:

> HO> The included pdf file does not set the color for the black rectangles
> HO> explicitly. At start of page the pdf default color is black.
> HO> But in your example the current color is green.
> 
> Is that what you think is happening, or do you have a utility to look what
> is actually in the PDF file.

You can use ghostscript to decompress PDF streams.

gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dCompressPages=false -sOutputFile=try_.pdf try.pdf

To see what's going on just write a small file, which sets the relevant
parts of the stream with the help of \pdfliteral.


\documentclass{minimal}
\usepackage{color}
\begin{document}
\color{green} % this affects the first rectangle

\null\vskip300pt
\pdfliteral{%
.2 0 0 .2 0 0 cm
1 g % rectangle are filled with color white
1 i
13.4546 864.745 1077.13 255.109 re
f*
9.4485 w
%0 G % try this <==
13.4546 864.745 1077.13 255.109 re
S
13.4546 439.562 1077.13 255.11 re
f*
1 0 0 RG % red stroking color
13.4546 439.562 1077.13 255.11 re
S
13.4546 14.3794 1077.13 255.109 re
f*
0 G % black stroking color
13.4546 14.3794 1077.13 255.109 re
S
}
\end{document}

The second rectangle sets the color to red (1 0 0 RG) and the
third sets it to black (0 G). But there is no color set for
the first rectangle, so it takes the latest used color, which
there is green in this example. (1 g) is the color white, with
which the rectangles are filled (f*).


Ciao
Andreas


More information about the pdftex mailing list