1

I'm dealing with an annoying behaviour of my pdf file. It seems that Acrobat or Reader doesn't recognize the images. I work with texlive on Ubuntu 11.04 and I compile the source file with pdftex in texmaker. The strange thing is that on my machine the pdf is fine, I can open it and see all the text and images correctly with evince and with Pdfxchange viewer running under wine. But if I switch to Windows with Acrobat or Reader I have this problem.

Does anyone have any clue? I'm using \pgfimage to generate the figures in my document.

MWE:

\documentclass[a4paper, oneside, 12pt]{book}
\usepackage{pgf}

\begin{document}

\begin{figure}[h]
\includegraphics[width=\textwidth]{image.png}
\end{figure}

\newpage

\begin{figure}[h]
\pgfimage[interpolate=TRUE, width=\textwidth]{image.png}
\end{figure}

\newpage

\begin{figure}[h]
\pgfimage[width=\textwidth]{image.png}

\end{figure}

\end{document}
Caramdir
  • 89,023
  • 26
  • 255
  • 291
  • With "Acrobat or Reader" you mean "Adobe Acrobat" (the "full" version) or "Acrobat Reader", don't you? What is displayed instead of the images? Is the place simply kept empty? Could you upload the PDF somewhere, if it isn't confidential, so we could have a look at it? The PDF (not 'pdf') format is supposed to be platform-independent so I'm surprised to hear about this issue. What kind of images are you using? JPEG, PNG or PDF? – Martin Scharrer Sep 14 '11 at 12:38
  • Yes, Acrobat is the full version, Reader is the light one. With both I have the same problem. When I reach a page with a graphic it gives me the error 'There was an error processing a page. There was a problem reading this document (110), which is a quite general message... The images are embeded with the command \pgfimage[interpolate=TRUE, width=\textwidth]{} and they are .png. You can check the file here: http://dl.transfer.ro/transfer_ro-13sep-a34a0086a308e8b0.zip . It's a report in Romanian. – Mihai Terente Sep 14 '11 at 14:55
  • 1
    I can't display the images using Adobe Reader 9.4.2 under Ubuntu Linux 11.04 as well. I get the same error as soon I scroll to page 4 which holds the first image. However, Evince, a free PDF viewer, displays the document correctly. I tried to run the PDF through pdftk to correct any errors in the file but didn't got any warnings and the resulting files caused the same errors. Maybe try without the interpolate option or with \includegraphics instead. – Martin Scharrer Sep 14 '11 at 15:31
  • (cont.) If this doesn't help make a minimal working example (MWE) that causes this issue and post it here. – Martin Scharrer Sep 14 '11 at 15:31
  • I just added a MWE. The problem was indeed the interpolate=TRUE option. So, a workaround would be not using the option or using \includegraphics as suggested by Martin. It would be interesting to test this on Windows to see if the problem still occcurs. Thanks! – Mihai Terente Sep 14 '11 at 16:13
  • 2
    You might want to mention that http://dl.transfer.ro/transfer_ro-13sep-a34a0086a308e8b0.zip is about 29 MB huge. (Or replace by a smaller minimal example.) – Stephen Sep 17 '11 at 10:40
  • What is the actual error you receive? – percusse Sep 20 '11 at 18:45
  • Just a wild guess: pdflatex sometimes produces broken PDFs for me which becomes apparent because pdftk can't process them. Compiling the same sources with LuaLaTeX gives me PDFs that are just fine. Maybe you should try the same as LuaLaTeX is more or less drop-in (as long as you get rid of inputenc and stuff). – Christian Jul 20 '12 at 21:16
  • This is not something most people most of the time, and it's hard for us to help with the information given. So I've closed as 'too localized'. – Joseph Wright Aug 05 '12 at 08:19

1 Answers1

1

PDF-Viewer incompatibilities seem to become a major nuisance of the Portable Document Format these days. It's a shame!

A workaround that has worked for me in the past is to pipe the PDF through Ghostscript for some sanitation:

 gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=foo-compressed.pdf foo.pdf

Originially, I have used this only for compression purposes. However, in my experience it solves many problems with peculiar PDF viewers, especially if one uses PGF quite a lot.

I was not able to test it with your example document (the download link was to instable), but you may want to give it a try.

Daniel
  • 37,517
  • In this case ghostscript internally converts the PDF to PostScript and then distills it to PDF. It works, but you lose quite a lot of information from the PDF. – Martin Schröder Oct 21 '11 at 20:06