[pdftex] Problem with colors in included PDF file

Piet van Oostrum piet at cs.uu.nl
Thu Jun 12 16:19:23 CEST 2003


>>>>> Heiko Oberdiek <oberdiek at uni-freiburg.de> (HO) wrote:

HO> 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.

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. If the color of the first box is really not
explicitly set to black I think this is a bug in the generation of the PDF
file. But that means that both fig2dev and epstopdf would have the same bug.

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

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

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

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

Yes, but only if that is what the user means. In this case I did not mean
that. I create my figures with xfig and that has a color selection called
'default' and I would expect that color to act as you describe: take the
current color of the environment. I haven't tried that, however.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl



More information about the pdftex mailing list