[pdftex] Color dependence of included pdf images

Heiko Oberdiek oberdiek at ruf.uni-freiburg.de
Mon Aug 13 02:58:44 CEST 2001


Hello,

I got a bugreport by Marcus Eger and report the result
of the examination:

Colors in included pdf images can be dependent on
the current text color, here a minimal test model:

%%% cut %%% stroke.ps %%% cut %%%
%!PS
%%BoundingBox: 100 100 200 200
100 100 moveto
200 200 lineto
stroke
showpage
%%% cut %%% stroke.ps %%% cut %%%

%%% cut %%% test.tex %%% cut %%%
\documentclass[a4paper,12pt]{article}
\usepackage{color,graphicx}
\pagestyle{empty}
\usepackage{times}
\begin{document}
\color{black}
Black color

\includegraphics{stroke}

\color{red}
Red color

\includegraphics{stroke}

Workaround with \verb|\textcolor{black}{...}|

\textcolor{black}{\includegraphics{stroke}}

End in red
\end{document}
%%% cut %%% test.tex %%% cut %%% test.tex

This could be fixed in pdftex.def by setting the
color explicitly to black. But the disadvantage
would be that then this effect could not be
used as feature.

For example the image can contain some text or
drawings without explicit use of colors. Then
it integrates into the current environment
very well: If the text on the page is black
on white, the image also is black on white.
If \pagecolor is used with current color
white, the image would be draw itself in
white also.

Therefore I think the best is to let pdftex.def
unchanged and use
  \textcolor{black}{\includegraphics{...}}
for pdf images that are generated with
default color black in mind.

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>




More information about the pdftex mailing list