[Tex/LaTex] Different image in every page’s footer

header-footertikz-pgf

I found
Using fancyhdr to create an image based header and footer
which is helpful and gave some ideas but I want to basically put in the bottom right or center of the footer a different image file (pdf or jpg) for each page in a latex document.

Any suggestions?

Thanks a lot!

P.S. Sorry, I typically use article class with lots of mathtools in latex or xelatex, but I am very flexible!

Best Answer

As JLDiaz mentioned in his comment, you can name your images image-1.png, image-2.png, etc. and then use the fancyhdr package to include them using

\includegraphics[<options>]{image-\arabic{page}}

from the graphicx package. A complete example:

\documentclass{article}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{lipsum}% just to generate text for the example

\setlength\footskip{40pt}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\thepage}
\fancyfoot[C]{\includegraphics[height=30pt]{image-\arabic{page}}}

\begin{document}

\lipsum[2-23]

\end{document}

enter image description here

Here's another possibility, using this time the background package:

\documentclass{article}
\usepackage{graphicx}
\usepackage[bottom]{background}
\usepackage{lipsum}% just to generate text for the example

\SetBgScale{1}
\SetBgContents{\includegraphics[height=30pt]{onebit-\arabic{page}}}
\SetBgVshift{40pt}
\SetBgOpacity{1}

\begin{document}

\lipsum[2-23]

\end{document}

enter image description here

Make sure to have as least as much images as the number of pages in your document.

After a comment, the idea is to have the images to the right, on the footer, but outside the text area; this can be accomplished, in the fancyhdr example, using \fancyfootoffset; a little example:

\documentclass{article}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{lipsum}% just to generate text for the example

\setlength\footskip{40pt}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\thepage}
\fancyfoot[R]{\includegraphics[height=30pt]{image-\arabic{page}}}
\fancyfootoffset[R]{4cm}

\begin{document}

\lipsum[2-23]

\end{document}

enter image description here

With the background approach, one can use \SetBgHshift{<length>}.