How to fix transparency issue in pdf output from Inkscape?


Question

I'm creating some histograms for use in a scientific article, The final figure is supposed to be a few graphs, each with two sets of data plotted showing how similar they are. In my example, I used Julia to generate two sets of data, and used Gadfly to draw the overlay to an SVG file. This was achieved by layering the histograms with some transparency in the bars. I opened the SVG file in Inkscape and added text descriptions and then saved it as a pdf for use in my tex file. However, the pdf do not display the transparency and just put one layer on top of the other with no interaction between the two. Oddly enough, the thumbnail preview panel in Evince does show the picture properly, which led me to think that it was simply a deficiency of Evince. I tried viewing the pdf in Okular, but there both the thumbnail preview and the pdf itself do not show the transparency. I'm somewhat confused as to where the problem actually is.

I dropboxed the SVG in question here and the PDF output here. The thumbnail in Evince looks like img, which is what I'm shooting for (except not for ants).

I'd really appreciate any advice on the matter. Thanks for the read!

1
5
12/5/2015 8:26:00 PM

Accepted Answer

Unfortunately the PDF format available from Inkscape does not support transparency. To still be able to create a PDF with an Inkscape drawing having transparent objects we will have to convert these to bitmap first.

For a single object or group this can be done with the Filter > Transparency utilities > Light Eraser.

We have to be aware that this filter does not preserve colors as expected. To obtain the results of such a conversion as it is displayed below I had to add another 90% opacity to the columns object's fill and stroke property.

enter image description here PDF with partly converted to bitmap with Light Eraser shown in Evince

When using another application for converting to PDF we get much better results. An Open Source application capable of doing so would be Open/Libre Office, which allows transparency on PDF export (objects are not converted to bitmaps):

enter image description here SVG imported to Libre Office, exported to PDF as shown in Evince

6
12/6/2015 5:16:00 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
^