[Tex/LaTex] PDFpages landscape with normal footer and header (on top)

landscapepdfpagesrotating

I want to use the pdfpages in Latex in landscape mode.

That's possible with the following code:

\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[landscape=true,pages=1-3,pagecommand={}]{Planning.pdf}
\end{document}

But I also want to keep the section and page number at the top and bottom of the page.
For example when I do this:

\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[landscape=true,pages=1-3,pagecommand={\subsection{Bijlage 1}}]{Planning.pdf}
\end{document}

The header is also rotated, including the footer.

Is it possible to get the header and footer at the 'normal' position (so at the top and bottom of the document, like in portrait mode).

Edit: It looks like my question isn't good explained. So I draw something on paper to clarify my question.

Drawing on paper

Best Answer

You can have a try with following MWEs:

  • portrait-pdf.tex : the portrait file that will be included via pdfpages

    \documentclass{scrartcl}
        \usepackage{graphicx}
    \begin{document}
        \centering
        \includegraphics*[width=.9\textwidth,height=.9\textheight]{example-image-a}
        \includegraphics*[width=.9\textwidth,height=.9\textheight]{example-image-b}
    \end{document}
    

You get this result:
enter image description here

  • landscape-pdf.tex : the landscape file that will be included via pdfpages

    \documentclass[landscape]{scrartcl}
        \usepackage{graphicx}
    \begin{document}
        \centering
        \includegraphics*[width=.9\textwidth,height=.9\textheight]{example-image-c}
        \includegraphics*[width=.9\textwidth,height=.9\textheight]{example-image}
    \end{document}
    

You get this result:
enter image description here

  • main.pdf: the file that includes previously generated PDF

    \documentclass{scrartcl}
        \usepackage{pdfpages}
        \usepackage{pdflscape}
        \usepackage{lipsum}
    \begin{document}
        \section{Regular text}
        \lipsum
    
        \begin{landscape}
            \includepdf[landscape=true,pages=1-2,pagecommand={\section{Include lanscape pdf}}]{landscape-pdf}
        \end{landscape}
    
        \includepdf[landscape=false,pages=1-2,pagecommand={\section{Include portrait pdf}}]{portrait-pdf}
    \end{document}
    

enter image description here

The only issue is that on page 3 and 4 of this PDF, pages number are "on the left side": see explanations and details here.