[Tex/LaTex] Koma-script header/footer change with includepdf

fancyhdrheader-footerkoma-scriptpdfpages

I'm (still) moving from regular LaTeX classes (report, article) to Koma-Script. Lots of things are just okay, but not everything.

My current problem lies with PDF inclusion and header/footer change for the included PDF pages.

In a lot of documents, I have to include PDF docs here and there. To make reading easier, I want to modify the footer or headers to add some data about the included PDF doc.

With report and article classes, fancyheaders and pagecommand, it is really easy :

\includepdf[addtotoc={1, section, 1, For the ToC, reference},
fitpaper=false,pages=-,frame,scale=0.7,
pagecommand={\thispagestyle{fancy}
             \fancyfoot[RE,LO]{\footnotesize\textbf{Some Footer}}}]{ThePDF}

No such luck when using scrheadings. I utterly fails to change the footer (or headers) for the included PDF pages.

Here is a minimal (not) working example :

\documentclass[headheight=1.2cm,headsepline]{scrartcl}
\usepackage[bottom=2.8cm,footskip=18mm]{geometry}

\usepackage[headsepline]{scrpage2}
\usepackage{lipsum}
\usepackage{pdfpages}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}

\pagestyle{scrheadings}

\chead[]{Center header}
\ihead[]{Inside header}
\ohead[]{Outside header}

\cfoot[]{Center footer -- \thepage{} --}
\ifoot[]{Inside footer}
\ofoot[]{Outside footer}

\begin{document}

\title{That is some title}
\author{Author name}
\date{Someday}

\maketitle
\tableofcontents

\section{Blah}
\lipsum[3-5]

\includepdf[addtotoc={1, subsection, 1, Included PDF,tag},
    turn=false,frame,scale=0.8,pages=1,
    pagecommand={\thispagestyle{scrheadings}
                 \ofoot{Another outside footer}
                 \ifoot{Another inside footer}
                 \chead{And a center header}}]{SomePDF}

\lipsum[3-5]
\end{document}

Any idea about what I'm doing wrong, or how to reach this goal ?

Best Answer

To reach your goal change the call of macro \includepdf in your MWE to:

{% Start group to have changes locally
\ofoot{Another outside footer}
\ifoot{Another inside footer}
\chead{And a center header}
\includepdf[%
  addtotoc={1, subsection, 1, Included PDF,tag},
  turn=false,frame,scale=0.8,pages=1-3,
  pagecommand={\thispagestyle{scrheadings}}
]{SomeFile.pdf}
}% Ends group, old footer and header are active ...

Now you get your new header and footer ...