[Tex/LaTex] Place a TikZ picture on every page

double-sidedheader-footertikz-pgf

I am looking to place a picture (TikZ picture) on every page of my document. How can I do that?

In essence I would like to control the placing of the image on even and odd pages. For example the holes on a folder sheet, these are placed to the left on odd pages and right on even pages.


Edit

So I am using Peter Grill's version just to test and I have the following:

\documentclass[svgnames]{article}
\usepackage[left=2.5cm,right=2.5cm, top=3.75cm, bottom=3.5cm,letterpaper]{geometry}
\usepackage[all]{background}
\usepackage{lipsum,url}
\usepackage{amsmath,amssymb,enumitem,multicol}
\usepackage{tikz,bbding}
\usetikzlibrary{calc}
\usepackage{changepage}
\strictpagecheck

\newcommand*{\VOffset}{2cm}% vertical offset
\newcommand*{\HOffset}{1cm}% horizontal offset

\newcommand{\MyTikzLogo}{% For a logo drawn with TikZ
\begin{tikzpicture}[remember picture,overlay,draw=black,ultra thick]
\checkoddpage
\ifoddpage
\draw  [fill=gray!50] (\HOffset,-\VOffset) circle (0.5cm);
\draw  [fill=gray!50] ($(\HOffset,-\paperheight+\VOffset)$) circle (0.5cm);
\draw  [fill=gray!50] ($(\HOffset,-0.5\paperheight)$) circle (0.5cm);
\else
\draw  [fill=gray!50] (\paperwidth-\HOffset,-\VOffset) circle (0.5cm);
\draw  [fill=gray!50] ($(\paperwidth-\HOffset,-\paperheight+\VOffset)$) circle (0.5cm);
\draw  [fill=gray!50] ($(\paperwidth-\HOffset,-0.5\paperheight)$) circle (0.5cm);
\fi
\end{tikzpicture}
}

\SetBgContents{\MyTikzLogo}% Set tikz picture

\SetBgPosition{current page.north west}% Select location
\SetBgOpacity{1.0}% Select opacity
\SetBgAngle{0.0}% Select roation of logo
\SetBgScale{1.0}% Select scale factor of logo

\parindent0pt \parskip8pt
\begin{document}
\begin{tikzpicture}[overlay, remember picture]
\node[yshift=-3cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
    \draw[draw=MidnightBlue,fill=MidnightBlue] (0,0) rectangle (0.75cm,3cm);%black
    \draw[draw=gray!20,fill=gray!20] (0.75cm,0) rectangle (\paperwidth,3cm);%gray!20   or LightSkyBlue and \paperwidth-0.01cm
\end{tikzpicture}};
\path (current page.north west) ++(0.5,-1.55) node[rotate=90] {\color{white}\tiny revised \today};
\path (current page.north east) ++(-1,-1) node[below left] {Name: \rule{2in}{.4pt}};
\path (current page.north east) ++(-1,-1.5) node[below left] {Date: \rule{2in}{.4pt}};
\path (current page.north west) ++(1,-0.5) node[below right] {Course Name};
\path (current page.north west) ++(1,-1) node[below right] {University};
\path (current page.north west) ++(1,-1.5) node[below right] {Mathematics and Science Department};
\end{tikzpicture}
\section*{Lorem Ipsum}
\lipsum[1-25]
\end{document}

The problem that i have is that when I try to print, the file does not seem to fill the entire page. The header part is just for the first page, the other pages will only contain the course name.

An insight into the matter will help.

Best Answer

Here is a solution adapted from How do I add an image in the upper, left-hand corner using TikZ and graphicx. This uses the background package to place a tikzpicture on each page. The logic for controlling the behavior on odd and even pages comes from this solution to if then else for odd page even page.

The parameters \VOffset and \HOffset control the positioning of the hole images:

enter image description here

\documentclass[12pt]{book}
\usepackage[demo]{graphicx}
\usepackage[all]{background}

\usepackage{lipsum}
\usepackage{showframe}
\usepackage{tikz}
\usetikzlibrary{calc} 

\usepackage{changepage}
\strictpagecheck

\newcommand*{\VOffset}{2cm}% vertical offset
\newcommand*{\HOffset}{1cm}% horizontal offset

\newcommand{\MyTikzLogo}{% For a logo drawn with TikZ
\begin{tikzpicture}[remember picture,overlay,draw=black,ultra thick]
\checkoddpage
\ifoddpage
    \draw  [fill=gray!50] (\HOffset,-\VOffset) circle (0.5cm);
    \draw  [fill=gray!50] ($(\HOffset,-\paperheight+\VOffset)$) circle (0.5cm);
    \draw  [fill=gray!50] ($(\HOffset,-0.5\paperheight)$) circle (0.5cm);
\else
    \draw  [fill=gray!50] (\paperwidth-\HOffset,-\VOffset) circle (0.5cm);
    \draw  [fill=gray!50] ($(\paperwidth-\HOffset,-\paperheight+\VOffset)$) circle (0.5cm);
    \draw  [fill=gray!50] ($(\paperwidth-\HOffset,-0.5\paperheight)$) circle (0.5cm);
\fi
 \end{tikzpicture}
}

\SetBgContents{\MyTikzLogo}% Set tikz picture

\SetBgPosition{current page.north west}% Select location
\SetBgOpacity{1.0}% Select opacity
\SetBgAngle{0.0}% Select roation of logo
\SetBgScale{1.0}% Select scale factor of logo

\begin{document}
\section*{Lorem Ipsum}
\lipsum[1-25]
\end{document}