# [pdftex] Problem with colors in included PDF file

Heiko Oberdiek oberdiek at uni-freiburg.de
Wed Jun 11 19:11:23 CEST 2003

On Wed, Jun 11, 2003 at 04:46:01PM +0200, Piet van Oostrum wrote:

> I have found a problem when including a PDF graphic in a LaTeX document.
> The colors of the included figure are sometimes wrong.
>
> For example in the following file:
>
> \documentclass{article}
> \usepackage{graphics,color}
> \begin{document}
> \color{green}
> \includegraphics{try}
> \end{document}
>
> I have put the picture online at http://www.cs.uu.nl/~piet/try.pdf because
> I am not sure if attachments are welcome on this list.
>
> The picture contains two black rectangles and a red rectangle. However, in
> the resulting pdf file that you get from pdflatex, one of the black boxes
> is green.

The included pdf file does not set the color for the black rectangles
explicitly. At start of page the pdf default color is black.
But in your example the current color is green.

Current solution:
\textcolor{black}{\includegraphics{try}}

Perhaps there will be an option in pdftex.def for setting
the default color:
\includegraphics[black]{try}
or
\includegraphics[defaultcolor=black]{try}

> The problem can of course be solved with
> \textcolor{black}{\includegraphics{try}} but this shouldn't be necessary,
> I think.

I considere it as feature that the same pdf file can be used
in different colors with the possibility to force a color.

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