[Tex/LaTex] Add header and footer to each page from a pdf template

sweavetemplates

I have a document and I would like to include a header and footer to each page.
The header and footer are at the top and bottom of an otherwise blank pdf file which is to be used as a template. Is there a way for me to overlay the header and footer of the pdf with the document?

\documentclass{article}
\usepackage{booktabs,caption,subcaption}
\usepackage{lipsum}% Just for this example

\begin{document}


\lipsum[1-25]

\end{document}

Best Answer

Here's an option using the background package:

enter image description here

The code (needs two runs for the elements to reach their final locations):

\documentclass{article}
\usepackage{booktabs,caption,subcaption}
\usepackage{lipsum}% Just for this example
\usepackage[scale=1,color=black,angle=0,opacity=1]{background}
\backgroundsetup{
contents={
  \begin{tikzpicture}[remember picture,overlay]
  \node[text width=\linewidth,anchor=south,align=center] 
    at ([yshift=1cm]current page.south)
    {This is the footer};
  \node[text width=\linewidth,anchor=south,align=center] 
    at ([yshift=-2cm]current page.north)
    {This is the header};
  \end{tikzpicture}%
  }
}

\begin{document}

\lipsum[1-25]

\end{document}

Using the options for the \nodes, you can control the desired positioning.