1

I'm creating a 100-pages-long procedurally generated document in which every page has a different background. The background picture is not procedurally generated, but it's loaded from a directory.

Up to now I used tikz for that, but as explained here I encountered some issue with the fact that the document needs several runs to get everything right. Sadly recently the document became so big that the background picture won't ever come out in the right position.

So, I'm looking for a way to set a background image without using tikz, since I believe that the issue is entirely caused by it: I have an other picture in the page, loaded with the usual \includegraphics command, and it always comes out in the right position.

3

1 Answer 1

3

See if this can fulfill your needs, note that there are other options, but most of them rely on TikZ internally.

\documentclass{article}
\usepackage{eso-pic,graphicx}
\usepackage[top=2cm, bottom=2cm, outer=0cm, inner=0cm]{geometry}
\newcommand{\background}[1]{%
\AddToShipoutPictureBG*{\includegraphics[width=\paperwidth,height=\paperheight]{#1}}
}
\begin{document}
Text here normally ...
\background{example-image-A}
\clearpage

text on next page ...
\background{example-image-B}
\clearpage

and text on third page ...
\background{example-image-C}
\end{document}

enter image description here

1
  • this is absolutely excellent! I see that it's slightly more complicated to set the opacity, and in fact I'm failing pretty hard in that, but for now I don't need that, so THANK YOU ;) May 11, 2017 at 11:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .