I'm creating a document with LaTeX and use icons in PDF format. Originally, I have them as SVG files but I have to convert them to PDF for LaTeX to include them.

Now I want to color the same icon differently depending on context. Here, Heiko Oberdiek writes:

If you are lucky and the PDF image does not contain any color operators [then it's easy].

So that's what I want to do! Using Inkscape, I have unset all stroke and fill colors. Also, I checked that the document properties do not set a color profile. The only references to colors I can see in the SVG are pagecolor="#ffffff" and bordercolor="#666666" on the root.

However, pdflatex is not able to color the icon.

In the uncompressed PDF, I find indeed

0 rg

and, elsewhere,

/CS /DeviceRGB

Can I make Inkscape generate a PDF without any color operators?

I tried removing pagecolor and bordercolor with a text editor and converting to PDF with inkscape -A icon.pdf icon.svg. No change.

  • Cannot answer, but I think the problem is that sRGB is implicit in SVG. There is no "greyscale" i.e. one channel which only stores brightness information. This is supported somewhat from the fact that any google search for greyscale SVG shows people using a filter matrix to force the colors to R=G=B. PDF is a container format that can contain arbitrary information, including executables, so I think "converting to PDF" is only going to port the source of the problem. – Yorik Sep 5 '17 at 14:25
  • May also want to ask this on [tex.stackexchange.com](tex.stackexchange.com) if you haven't already. – Scribblemacher Sep 5 '17 at 14:33
  • @Scribblemacher I considered it, but since the workflow to PDF icon has, in my case, nothing to do with (La)TeX, I decided against it. I'm sure they could tell me how to create suitable PDF icons using LaTeX, but that won't help me a whole lot with pre-existing icons. – Raphael Sep 5 '17 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.