5

I came across a weird issue when you include multiple graphics files when one is a non-clipped .pdf and the others are clipped non-pdf. I'm running pdflatex and the resulting pdf is created and can be opened fine in Evince, but I can't open it in Adobe Reader, due to the error: "There was an error opening this document. The file is damaged and could not be repaired." Here's my MWE:

\documentclass{article}

\usepackage{graphicx}

\begin{document}

\includegraphics[width=2in]{test.pdf}
\includegraphics[width=2in,trim=5 5 5 5,clip]{test.png}

\end{document}

I have a workaround which is to clip the .pdf graphic as well

\includegraphics[width=2in,trim=0 0 0 0,clip]{test.pdf}

but I'm still curious to know what the problem is.


EDIT: Per @Heiko Oberdiek's comment, I tried to reproduce the problem with different image files which I could post for everyone. It seems there is no problem most of the time, I evidently stumbled on the perfect combination for disaster. Here's my new MWE:

\documentclass{article}
\usepackage{graphicx}
\begin{document}

% A: Created powerpoint template with image as background. Then saved as pdf.
\includegraphics[width=2in]{test_powerpoint.pdf}

% B:
% \includegraphics[width=2in,trim=0 0 0 0,clip]{test_powerpoint.pdf}

% C: Original creation of image using tikz and pdflatex
% \includegraphics[width=2in]{test_latex.pdf} 

% 1: Extracted eps image from test_latex.pdf using pdftops, 
% then converted to pdf using convert tool in linux
\includegraphics[width=2in,trim=5 5 5 5,clip]{test_latex_convert.png} 

% 2: Took snapshot of image in test_latex.pdf, saved graphic as .png
% \includegraphics[width=2in,trim=5 5 5 5,clip]{test_latex_snapshot.png} 

\end{document}

The images files can be downloaded: test_powerpoint.pdf, test_latex.pdf, test_latex_convert.png, test_latex_snapshot.png.

It turns out the ONLY combination that doesn't work is A1. (The generated pdf is here.) Everything else is fine, so I'm not even sure if it's the .pdf or the .png file that's the problem.

  • Can you put test.pdf, test.png and the generated PDF file somewhere for download? – Heiko Oberdiek May 7 '15 at 15:24
  • If I substitute your input files with example-image.pdf and example-image.png (which are LaTeX demo graphics), the result can be opened fine in Adobe reader. – Steven B. Segletes Aug 1 '17 at 11:16

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.