# Tikzpicture as background to pdfpages

I want to implement the answer here: Can I add tikzpictures to pages included with pdfpages. But I want the tikzpicture under the included pdf pages, not over it. Is there a straightforward way to set what is drawn first?

Update

As cyberSingularity mentions my original answer was wrong. I just used background package with the idea that it adds tikzpictures to background. It does it, but not when page contents is defined by pdfpages. Why?

Because pdfpages package uses eso-pic's \AddToShipoutPictureBG command to print its composition so, pdfpages result are also printed in background.

Therefore, a better solution could be to also use \AddToShipoutPictureBG command for printing our tikzpicture. Something like:

\documentclass[a4paper]{article}
\usepackage{tikz}
\usepackage{pdfpages}

\begin{tikzpicture}[remember picture,overlay]
\node[minimum width=5cm, minimum height=5cm, font=\Huge,
circle, draw=red, ultra thick, opacity=1, fill=pink, text=red]
at (current page.center) {???};
\end{tikzpicture}
}

\begin{document}
\includepdf[pages=-,]{blind}
\end{document}


Next detail shows that tikzpicture (red question marks and pink background) is behind included pdfpages as OP wanted.

A little example with background package. There are some other packages in CTAN which can put some background to every or selected pages: watermark, wallpaper, xwatermark, ...

\documentclass[a4paper]{article}
\usepackage{background}
\usepackage{pdfpages}

\backgroundsetup{
scale=3,
angle=0,
contents={\begin{tikzpicture}[remember picture,overlay]\node[minimum width=3cm,minimum height=3cm,font=\Huge,circle,draw,ultra thick] {?};\end{tikzpicture}
}
}

\begin{document}
\includepdf[pages=-,nup=2x2]{blind}
\end{document}


• @cyberSingularity You're right. I'll have to look more carefully but looks like pdfpages prints the result in background and anything else is added over it, even watermark is printed over pdfpages. – Ignasi Mar 10 '15 at 10:48
• @cyberSingularity I think I've found a better solution. Thank you for advertising the mistake. – Ignasi Mar 10 '15 at 15:53