Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to include a pdf with a transparent gradient using pdflatex from texlive installed with macports. Using the article class (not standalone), the transparency of the included pdf is lost when opened with Preview.app (amongst other viewers). Yes, it is there when viewed with Acrobat or Chrome, but I can't force my readers to use these viewers.

I have also noticed this problem when filtering my pdf through ghostscript.

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output_gs.pdf white2green1.7.pdf

So while the original file white2green1.7.pdf shows the transparency correctly in Preview.app etc., the new file output_gs.pdf does not.

Is pdflatex running my pdfs through ghostscript? Is there anyway to avoid this?

I have tried reducing the PDF version of the included graphics down to 1.4. I am also unhappy with resorting to rasterizing or flattening the transparency.

For reference, the tex I'm compiling is:

\documentclass{article}
% these two lines don't change the result
\pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>}
\pdfoptionpdfminorversion 7
\usepackage{graphicx}
\begin{document}
  \begin{figure}
    \includegraphics[width=\linewidth]{{{white2green1.7}}}
  \end{figure}
\end{document}
share|improve this question
1  
I believe it's a PDF viewer issue. –  egreg Aug 23 '13 at 17:12
    
Agreed. I just tested using MacTeX 2013 and while the file looked wrong in TeXshop (using Apple's pdf previwer), it looks fine when I open it in Adobe Acrobat Professional X. This is especially odd, since the original graphics file is previewed correctly when directly opened by TeXshop. –  WillAdams Aug 23 '13 at 17:29
add comment

1 Answer

When including pdf with features such as transparency or gradients, you should make sure that the version of the pdf created by pdflatex matches the one of the file with the highest version. in this case you should try and make sure that latex create a pdf 1.7 document instead of the default (1.4 or 1.5) This is done by have the following line in your preamble:

\pdfoptionpdfminorversion 7

Also, pdflatex does not add the transparency attribute to the pdf header. this can result in not nice lloking fonts on some pages with some viewers (including adobe reader). The fix for that is adding the following line before the \documentclass{} line.

\pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>}
share|improve this answer
    
Unfortunately, neither of these fix my problem. See tex in updated question. –  mangledorf Aug 23 '13 at 15:05
    
@mangledorf Having tested your code on mac I can indeed see the same thing. however, it is not the transparency which is not working for me but only the gradient. (the light blue square is indeed transparent can one can see the text through it.) can you confirm that this is the case for you? –  ArTourter Aug 23 '13 at 17:19
    
Indeed. That's why I put the square there. I should have stated that in the question. –  mangledorf Aug 23 '13 at 21:21
    
Actually pdftex does try to switch on transparency in Adobe viewers (or at least it did some time ago); see Multiple pdfs with page group included in a single page warning. And setting the PDF version to 1.4 should be enough; there's no need to go to 1.7. –  Martin Schröder Aug 30 '13 at 11:42
    
Well, it may indeed switch transparency on, but it does it in such a way that display gets rather messed up on pages with transparency elements (font become heavier and look not anti aliases. Adding the \pdfpageattr line make the document uniform. I suspect the default is to change the transparency setting on a page to page basis which for some reasons adobe reader cannot render properly. As for the advice to increase the pdf version, I was only doing that to match the highest version of the included elements. The other solution would be in reduce the pdf version of the image at creation. –  ArTourter Aug 30 '13 at 12:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.