[Tex/LaTex] Fancy header and footers

fancyhdrheader-footer

I would like to create header and footers for all the page in my latex PDF, they should look:

Header

1) one inch thick; background color: Blue; left hand-side: DOCUMENT Title; right hand-side: Logo (logo.jpg; file placed in DOCUMENT folder);

Footers

1) half inch think; background color: Blue; left hand-side: page number; center: Chapter Title; right hand-side: Date; Only even pages.

2) half inch think; background color: Blue; left hand-side: Date; center: Chapter Title; right hand-side: page number; Only odd pages.

\documentclass[twoside,a4paper]{report}
\usepackage{fancyhdr, graphicx}
\usepackage{makeidx}
\usepackage{ifthen}
\usepackage{framed}
\usepackage[usenames, dvipsnames]{color}
\usepackage{environ}
\usepackage{xcolor}
\usepackage[tikz]{bclogo}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{DejaVuSansCondensed}
\makeindex
\begin{document}

\maketitle
\newpage
%-- header here
%-- even footer here

\newpage
%-- header here
%-- odd footer here

\end{document}

Best Answer

This is easily done with TikZ which you're already loading. I didn't set any margins, but if you're using twoside, maybe you want proper margins for the binding. If so, let me know and I'll fix the example.

Output

enter image description here

enter image description here

Code

\documentclass[twoside]{report}
\usepackage[a4paper, left=1.5cm, right=1.5cm, bindingoffset=1.5cm]{geometry}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{etoolbox}
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{}

\definecolor{gmitblue}{RGB}{93,138,168}

\usetikzlibrary{calc}
\renewcommand{\headrulewidth}{0pt}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{%
\begin{tikzpicture}[overlay, remember picture]%
    \fill[gmitblue] (current page.north west) rectangle ($(current page.north east)+(0,-1in)$);
    \node[anchor=north west, text=white, font=\Large\scshape, minimum size=1in, inner xsep=5mm] at (current page.north west) {A reasonably long title};
    \node[anchor=north east, minimum size=1in, inner xsep=5mm] at (current page.north east) {\includegraphics[scale=.2]{example-image-a}};
      %node[minimum width=\x2-\x1, minimum height=2cm, draw, rectangle, fill=blue!20, anchor=north west, align=left, text width=\x2-\x1] at ($(current page.north west)$) {\Large\bfseries \quad #1};
\end{tikzpicture}
}
\fancyfoot[CE]{
    \begin{tikzpicture}[overlay, remember picture]%
    \fill[gmitblue] (current page.south west) rectangle ($(current page.south east)+(0,.5in)$);
    \node[anchor=south west, text=white, font=\Large, minimum size=.5in] at (current page.south west) {\thepage};
    \node[anchor=south, text=white, font=\large, minimum size=.5in] at (current page.south) {\leftmark};
    \node[anchor=south east, text=white, font=\large, minimum size=.5in, inner xsep=5mm] at (current page.south east) {\today};
\end{tikzpicture}
}
\fancyfoot[CO]{
    \begin{tikzpicture}[overlay, remember picture]%
    \fill[gmitblue] (current page.south west) rectangle ($(current page.south east)+(0,.5in)$);
    \node[anchor=south west, text=white, font=\large, minimum size=.5in, inner xsep=5mm] at (current page.south west) {\today};
    \node[anchor=south, text=white, font=\large, minimum size=.5in] at (current page.south) {\leftmark};
    \node[anchor=south east, text=white, font=\Large, minimum size=.5in] at (current page.south east) {\thepage};
\end{tikzpicture}
}
\setlength{\headheight}{12pt}

\title{A reasonably long title}
\date{\today}
\author{The author}

\begin{document}
\maketitle
\chapter{first chapter}
\lipsum[1-9]

\chapter{second chapter}
\lipsum[10-19]
\end{document}