I create slides for teaching on a GNU/Linux machine and test in Okular. I then transfer the files to university storage so that I can use them in class. This has been working well. However, today, Adobe Reader 2017 reported 2 of the 3 PDFs as damaged. In both cases, the slides displayed fine except that all images of hospitalised hedgehogs were missing. The space was there, but no hedgehog. All other images displayed fine. All text displayed fine.
I just re-transferred the 'damaged' PDFs to my laptop and the files are identical to those I uploaded. I also double-checked that the originals include the hopsitalised hedgehog everywhere they should. Okular shows everything is fine.
Adobe Reader XI reports corrupted PDF for pdfTeX compiled combination beamer + overlay + textblock + includgraphics seems related, but it is difficult to be sure and the comments say the problem can't be reproduced.
The image causing the problem for me is included as PDF. But the slides also use a picture of a cat, also included as PDF, and not a problem.
If I read the content of the PDF as text, I can see the file path for the PDF images. (I was surprised by this – I didn't realise the original file path would be included.)
The only two differences I can see in the treatment of the two images is that
- the hedgehog is included multiple times at different sizes, whereas the cat image is included only once at a single size;
- the hedgehog is saved into a box at one of the sizes and used as a 'logo' on various slides, whereas the cat is not.
However, I am not sure how to tell whether either, both or neither of these is the problem or not.
Creating an MWE is tricky because I have no way of knowing when the problem has gone away, since I only use Windows in the classrooms I teach in and don't have it available otherwise. (If necessary, I can use a lab computer for testing, but that's a pain.)
Basically, a schematic of my code would look like this:
\pdfminorversion=7
\documentclass{beamer}
\begin{document}
\begin{Form}
\begin{frame}
\includegraphics[width=\textwidth]{hedgehog}
\end{frame}
\begin{frame}
\includegraphics[width=.225\textwidth]{hedgehog}
\end{frame}
\begin{frame}
\includegraphics[width=\textwidth]{cat}
\end{frame}
\end{Form}
\end{document}
The logo code I'm using looks like this
\newsavebox{\hhl}
\sbox{\hhl}{%
\includegraphics[scale=.5]{hedgehogs/hedgehoghospital}}
\newcommand*\hhllogo{%
\logo{\usebox{\hhl}}% followed by code to create an attribution at the bottom of slides
}
\newcommand*\nologo{%
\logo{}% followed by code to clear the attribution from the bottom of slides
}
\hhllogo
Would either the inclusion of a PDF image at multiple sizes or the placement of the PDF using Beamer's \logo{}
be expected to create issues for Adobe Reader 2017? I should note that this code worked fine with earlier versions of Reader, as I've not had this problem before and these slides are virtually unchanged from previous years.
If the answer to the above is 'No', how can I best debug this in order to figure out what I need to avoid to get things working correctly?
Best Answer
The PDF file has many errors.
Output of
ps2pdf
(ghostscript):Evince reports:
Xpdf reports the same error:
The error (sc) seems to be present in
hedgehoghospital.pdf
. It is s low-resolution bitmap image with a PDF wrapper.The offending code:
I have not found the corresponding
cs
operator that defines the color space. Maybe, the default is/DeviceRGB
with three parameters and0 sc
only uses one parameter.Workarounds:
Maybe, you can find/generate a better version of
hedgehoghospital.pdf
, preferable a vector version.Use of the bitmap data (PNG) without PDF wrapper:
The program
pdfimages
can be used to extract the bitmap data. Since, I do not havehedgehoghospital.pdf
, I have used the third page (pdftk 5-kant4-fhei-p.pdf cat 3 output 3.pdf uncompress
).This generates:
h-0000.ppm
, the image datah-0001.ppm
, the transparency maskNext, the image mask needs to be saved in grayscale format:
Then both images can be composed to the PNG file:
Then,
hedgehog.png
can be used instead ofhedgehog.pdf
: