Using fancyhdr to create an image based header and footer

I found a better solution using the wallpaper package, replacing foo and bar produces the desired result.

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{wallpaper}

\begin{document}
\ULCornerWallPaper{1}{foo}
\LLCornerWallPaper{1}{bar}
\lipsum[1-3]
\end{document}

If you are not stuck on using fancyhdr, you could adapt the solution from How do I add an image in the upper, left-hand corner using TikZ and graphicx which uses the background package:

enter image description here

Notes:

  • Need at least two runs to see the images.

Code:

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

\usepackage{lipsum}
\usepackage{showframe}
\usepackage{tikz}

\newcommand{\MyGraphicLogo}{% For imported graphic logo
\begin{tikzpicture}[remember picture,overlay]
  \node at (current page.north) {\includegraphics[width=\paperwidth,height=4cm]{foo}};
  \node at (current page.south) {\includegraphics[width=\paperwidth,height=4cm]{bar}};
 \end{tikzpicture}
}

\SetBgContents{\MyGraphicLogo}% Select included image

\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-16]
\end{document}

I think the command you are looking for is \fancyhfoffset. The left side seems needs to increase by \oddsidemargin + \hoffset + 1in and the right side needs to increase by \evensidemargin + \marginparwidth - \marginparsep (this is surprising to me I thought it would have been plus \marginparsep).

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{calc}

\fancypagestyle{plain}{%
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
    \fancyhf{}
    \fancyhead[L]{\hrulefill{}}%
    \fancyhead[R]{\hrulefill{}}%
    \fancyfoot[L]{\hrulefill{}}%
    \fancyfoot[R]{\thepage}%
}

\fancyhfoffset[L]{\oddsidemargin + \hoffset + 1in}
\fancyhfoffset[R]{\evensidemargin + \marginparwidth - \marginparsep}

\pagestyle{plain}
\begin{document}
First page

\clearpage

Second page
\end{document}