Transparent Objects Saved as Opaque in PDF
gusdemann
When saving graphics as a PDF from either Igor 7 or 8, transparent objects are converted to opaque.
Saving a PDF generates Graph1.pdf (attached) and it is clearly made of only opaque objects.
SavePICT/E=-8/EF=2
Instead, saving a PNG of the same graph (with the Transparency box checked), gives Graph1.png (attached).
SavePICT/E=-5/TRAN=1/B=576
Am I doing something wrong, or are transparent objects somehow not supported in PDFs exported from Igor?
The complete code to make the graph:
Make/D Sine,Cosine
Sine = sin(2*pi*x/64)
Cosine = cos(2*pi*x/64)
Display Cosine,Sine
SetAxis/A
ModifyGraph mode(Sine)=7,usePlusRGB(Sine)=1,plusRGB(Sine)=(65535,0,0,32768)
ModifyGraph hbFill(Sine)=2
ModifyGraph mode=7,usePlusRGB=1,useNegRGB(Cosine)=1,rgb(Cosine)=(1,16019,65535),plusRGB(Cosine)=(1,16019,65535,32768),negRGB(Cosine)=(1,16019,65535)
ModifyGraph hbFill=2
ModifyGraph hbFill(Cosine)=1
ModifyGraph hbFill=2
ShowTools/A arrow
SetDrawEnv linefgc= (1,52428,52428),fillfgc= (2,39321,1,32768),linethick= 2.00
Sine = sin(2*pi*x/64)
Cosine = cos(2*pi*x/64)
Display Cosine,Sine
SetAxis/A
ModifyGraph mode(Sine)=7,usePlusRGB(Sine)=1,plusRGB(Sine)=(65535,0,0,32768)
ModifyGraph hbFill(Sine)=2
ModifyGraph mode=7,usePlusRGB=1,useNegRGB(Cosine)=1,rgb(Cosine)=(1,16019,65535),plusRGB(Cosine)=(1,16019,65535,32768),negRGB(Cosine)=(1,16019,65535)
ModifyGraph hbFill=2
ModifyGraph hbFill(Cosine)=1
ModifyGraph hbFill=2
ShowTools/A arrow
SetDrawEnv linefgc= (1,52428,52428),fillfgc= (2,39321,1,32768),linethick= 2.00
Using Igor 8 with SavePICT/E=-2 I get a quartz PDF with transparency maintained.
March 4, 2019 at 08:15 am - Permalink
Igor PDF (SavePict/E=-8) does not support transparency. This is documented in the table that is part of the following help topic:
DisplayHelpTopic "Exporting Graphics (Windows)"
If you are using Macintosh, you can export as Quartz PDF (/E=-2) which does support transparency. Otherwise I can think of the following options:
1. Export using a format that does support transparency. That includes PNG, SVG, and I believe EMF.
2. It is possible that if you use File->Print and "print" to a PDF file, transparency will be preserved.
March 4, 2019 at 08:18 am - Permalink
In reply to Igor PDF (SavePict/E=-8)… by aclight
Thanks for the quick reply! I have to admit, I feel a little foolish. I was looking at the SavePICT command help which doesn't mention the issue - it might be worthwhile to a note to that help file.
There are many cool new features in Igor 7 and 8, and one of them is support for transparency in colors. I find it disappointing and somewhat perplexing that transparency is not supported in PDF exports on Windows, and I am left with the lingering question, "Why?" Something to add to the wishlist I guess...
For those who might be curious, my workaround is to export graphics from Igor in all their transparent glory as SVG, then convert them to a PDF in Inkscape, a free software that does support transparency in PDF exports on Windows. The result is attached.
March 4, 2019 at 11:07 am - Permalink
In reply to Thanks for the quick reply! … by gusdemann
Dare I say that, AFAIK, this may be because PDF is akin to an afterthought option on Windows versus being an in-built option on macOS.
March 5, 2019 at 10:35 am - Permalink
And with Macintosh support, we didn't really feal a lot of point in putting a lot of effort into our own PDF generation. Even on Windows these days you can Print to PDF. I don't know what it would take to access the PDF Printer programmatically.
March 5, 2019 at 04:46 pm - Permalink
This is an old thread, but for the record Igor 9 (currently in beta, see https://www.wavemetrics.com/form/igor-pro-9-beta-tester-signup to sign up) can export as Igor PDF on both platforms using new code for generating the PDF that supports transparency and also supports exporting special characters better than in previous versions.
December 2, 2020 at 06:11 am - Permalink