# Re: Change of colour for included pdf graphics

Steve and Klaus,

Thanks for your help.

Just as a record for the Archive (I always like to see solution in mail
archives, if you can call this a solution!)

On Thursday 16 August 2001 5:04 pm, you wrote:

> > Now to my problem. I have some included some pdf graphics using
> > \includegraphics (graphicx) package. All works fine, except that I also
> > use the darkbackground powersem documentclass option. In addition to
> > converting the text colour from black to yellow on a darkbackground it
> > also converts the colours in the included pdf document.
>
> I think at the heart of this matter is the pdftex behaviour
> reported by Heiko Oberdiek in
> http://tug.org/pipermail/pdftex/2001-August/008838.html
> If a pdf object in a pdf graphich included by pdftex has no defined
> color, it will assume the current text color.
>
> I'm not a postscript expert, but looking at you eps file, I get
> the impression that all objects therein have defined colors.
>
> So I guess different versions of ghostscript leave a different
> number of theses colors out on pdf generation, so all
> uncolored' objects get the text color while the objects
> which retain their color are colored as specified in the
> eps file.
>

Having looked at the fig -> eps -> pdf generation I was using I can confirm
that transfig and/or xfig generate some objects with no colour specified.
This results in black being changed to the new textcolour but the non colour
specified objects looking black. The effect is made (seemingly) random by
ghostscript < 6.0 but seems to only apply to text in ghostscript >= 6.0 and
only really applies to the xfig generated pics although I have not
exhaustively tested all graphic generation packages.

I have fixed this by giving my included graphics a white background and
fixing the colour of the text items to black. ie:

\textcolor{black}{
\begin{picture}(0,0)
\put(6,-4){\colorbox{black}{\phantom{\includegraphics[width=#2]{#1}}}}
\end{picture}
\colorbox{white}{\includegraphics[width=#2]{#1}}}

The textcolor macro stops the swapping of textcolor temporarily.

I define a standard Fig macro that adapts its style to suit pdf-for-display,
print-as-pdf-or-ps or html output.

Hope this helps someone else in the future looking for a solution to the
problem!

Martin

--
/ Dr. M.J. Reed                               Room:          4SB.6.15 \
| Dept. Electronic Systems Engineering         Tel:+44 (0)1206 872479 |
| University of Essex, Colchester CO4 3SQ, UK  FAX:+44 (0)1206 872900 |
\ mailto:[EMAIL PROTECTED]    Web: http://esewww.essex.ac.uk/~mjreed /

`