3

I have the following minimal example (cracks.tex):

\documentclass{article}
\usepackage{graphicx}

\begin{document}
\includegraphics[width=0.9\linewidth]{spirale}
\includegraphics{raman}
\end{document}

The graphics files are:

The PDF generated by pdflatex cracks.tex cannot be viewed in Acrobat Reader XI (Windows 7). The error message is “the document is damaged and cannot be repaired”. Evince can display the document, and if I switch the graphics or change their sizes, it works mostly even in the Reader.

Somehow the PNG seems to trigger the trouble because I can replace raman.pdf with another image and the problem persists.

Why is this and what can one do about it?

  • At least, I could open an view the PDF in Acrobat on MacOS :-( – Jan Jan 11 '17 at 12:53
  • Confirmed. AR-9.4.1 (Linux) produces a similar error message. – AlexG Jan 11 '17 at 13:25
  • 1
    I suggest you resave your .png by copy-pasting it into a new file and try again. – Chris H Jan 11 '17 at 13:57
  • raman.pdf seems to be problematic. Replacing it with example-image.pdf from pkg mwe doesn't produce the error. – AlexG Jan 11 '17 at 14:10
  • acroread 9.5.5, does not like it either. But AR does not have a problem with ramman.pdf it self – daleif Jan 11 '17 at 15:03
  • @AlexG try outcommenting the PNG, then then AR has no problem with the file from pdflatex. – daleif Jan 11 '17 at 15:06
  • Already did it. :-) – AlexG Jan 11 '17 at 15:07
  • @AlexG dis you also try the blank line between the two images? – daleif Jan 11 '17 at 15:08
  • 1
    Yes. On a page of its own, raman.pdf is ok. – AlexG Jan 11 '17 at 15:09
  • @AlexG perhaps you should add that to your answer – daleif Jan 11 '17 at 15:23
  • Curiously, replacing spirale.png with ctan-lion.png also makes the error disappear. Maybe both files are flawed and cannot coexist? – AlexG Jan 11 '17 at 15:26
  • @AlexG doesn't that just prove that the PNG is the problem? – daleif Jan 11 '17 at 15:28
  • If you replace raman.pdf with example-image.pdf (and keep the PNG) the error also goes away. What now? – AlexG Jan 11 '17 at 15:30
  • Got ImageMagick or GraphicsMagick? Try mogrify -strip <image file name> to remove metadata. Might help if the image has some off-syntax cruft there. In general, Adobe products are more finicky about opening PDF with errors. This is an advantage. Many times I have created an erroneous PDF that could open just fine in the built-in TeX document reader, and in Linux Evince, but not in Adobe Reader for Linux or any Adobe products on Windows. The problem was the PDF, not the software. I could identify the problem by uncompressing the PDF and looking in a hex editor. –  Jan 11 '17 at 18:40

2 Answers2

5

The issue is reproducible in an older version (9.4.1, Linux) of AR which refuses to display the document.

pdflatex of TeXLive-2016 with up-to-date packages was used to process the document.

On the other hand, a PDF produced with xelatex or lualatex is OK.

Further tests replacing files one by one identified raman.pdf to be the problematic file, that pdflatex cannot embed correctly.

As a work-around for pdflatex, without the need to repair it, the problematic file could be encapsulated into a PDF-XObject:

\documentclass{article}
\usepackage{graphicx}
\usepackage{xsavebox}

\begin{document}
\includegraphics[width=0.9\linewidth]{spirale}
\xsbox{Raman}{\includegraphics{raman}}\theRaman
\end{document}
AlexG
  • 54,894
1

to fix this issue, you just have to had the following line at the top of the .tex before the \documentclass{} line:

 \pdfminorversion=4

as suggested in this conversation : How to overcome Acrobat Reader error 131 with a pdfLaTeX doc?