2

Using the Latex eso-pic package I am inserting a background image using the following lines:

\AddToShipoutPictureBG{
 \AtStockLowerLeft{
  \includegraphics[width=\paperwidth,height=\paperheight]{picture}}}

\begin{document}
...

This works; every page now has my picture as the background. However, as soon as I insert a picture in any of my chapters and I open the created *.pdf document using adobe reader (after succesfull compilation using pdflatex), adobe crashes with the following message: "There was an error processing a page. There was a problem reading this document (131).". I use the following lines for inserting pictures:

\begin{figure}[h]
 \begin{centering}
  \includegraphics[width=1.0\columnwidth]{my_picture}
 \par\end{centering}
 \protect\caption{This is my picture.
 \label{fig:my_picture}}
\end{figure}

I have the feeling that this is caused by the fact that I'm trying to draw two pictures on top of each other (background + in-text picture). But I have no idea on how to solve this. Any ideas?

Below I added an example:

\documentclass[english]{report}

\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\usepackage{graphicx}
\usepackage{eso-pic}

%Uncomment following lines to enable background picture (note that there is a 
%bug right now, for some reason having a background image and iserting images
%using \includegraphics does not work correctly. It does compile but *.pdf
%document can not be opened.)
%\AddToShipoutPictureBG{
% \AtStockLowerLeft{
%  \includegraphics[width=\paperwidth,height=\paperheight]{background}}}

\begin{document}

% ---------------------------------------------------------------------------- %

\chapter{Introduction \label{chap:Introduction}}

\section{Background}
Blabla

\begin{figure}[htb]
 \centering
  \includegraphics[width=1.0\columnwidth]{figure_1}
 \caption{This is my first picture.}\label{fig:figure_1}
\end{figure}

% ---------------------------------------------------------------------------- %

\chapter{Conclusion \label{chap:Conclusion}}

\section{Conclusion}

We can draw the following conclusions:
\begin{itemize}
 \item Conclusion 1
\end{itemize}

\begin{figure}[htb]
 \centering
  \includegraphics[width=1.0\columnwidth]{figure_2}
 \caption{This is my second picture.}\label{fig:figure_2}
\end{figure}

% ---------------------------------------------------------------------------- %

\end{document}

This code compiles fine and I can open the resulting PDF file. However, as soon as add the background by uncommenting the comment lines compiling is no problem but viewing using acrobat reader is a different story: "There was a problem opening this document. The file is damaged and could not be repaired."

  • Welcome to TeX.SX! Please make your minimal working example (MWE) compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code! – ebosi May 30 '16 at 9:16
  • @ebo Thanks for the pointer, I just added a MWE. – smehrlapf May 30 '16 at 10:06
  • provide your image. I suppose that the problem is located in the pdf of the image. – user2478 May 30 '16 at 10:08
  • I found that when using the same image for both figure_1 and figure_2 (can be any image, tried at least 4 of them), there is no problem. The problem occurs as soon as I use two different images for picture_1 and picture_2. – smehrlapf May 30 '16 at 10:28
1

use it this way:

\begin{figure}[htb]
 \centering
  \includegraphics[width=1.0\columnwidth]{my_picture}
 \caption{This is my picture.}\label{fig:my_picture}
\end{figure}

\centering is a switch and not an environment and \caption itself starts a new paragraph. And for width=1.0\columnwidth the \centering is not needed, the image is already of linewidth

  • Inserting a figure works perfectly the way you described. However, the problem open the pdf file is still there; "There was an error processing a page. There was a problem reading this document (131)." – smehrlapf May 30 '16 at 9:41
  • try a different viewer for a test. – user2478 May 30 '16 at 9:53
  • just tried to open it using evince pdf viewer (on Ubuntu 14.04 LTS) and Chrome browser buildin viewer (on my Windows 7 machine). Guess what, it opens without any problems in both cases. So I only have the problem with Adobe reader (on my Windows 7 machine). I'm using Adobe Reader XI 11.0.0. – smehrlapf May 30 '16 at 13:54
0

Just found the solution in this post: How to overcome Acrobat Reader error 131 with a pdfLaTeX doc?

Adding the following line at the very beginning of the tex file did the trick

\pdfminorversion=4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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