PDFpages landscape with normal footer and header (on top)

1,127

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.

Share:
1,127

Related videos on Youtube

koenieee
Author by

koenieee

Updated on August 01, 2022

Comments

  • koenieee
    koenieee over 1 year

    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

    • T. Verron
      T. Verron about 7 years
      Welcome to TeX.sx! Please take the time to add a full MWE (minimal working example), that is a compilable (with documentclass and such) document illustrating the problem, so that people willing to help are given all the elements they might need.
    • koenieee
      koenieee about 7 years
      I added a small example.
    • ebosi
      ebosi about 7 years
      Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it).
    • ebosi
      ebosi about 7 years
      Untried solution: is the option pagecommand={\thispagestyle{headings}} working?
    • koenieee
      koenieee about 7 years
      @ebo, thanks I was wondering how I could get the syntax highlighting on.
    • koenieee
      koenieee about 7 years
      @ebo, your solution is not working because the headers are at the side of the page instead at the top.
    • ebosi
      ebosi about 7 years
      @koenieee well, I actually tried it, and page numbers are correctly positioned regarding the sheet of paper (i.e. without considering the included PDF), that is, at the upper right corner of the sheet of paper. It is what you want, isn't it? (NB: your pdf viewer might rotate the page you're look at.)
    • koenieee
      koenieee about 7 years
      Thanks for trying, but I want the page numbers at the bottom of the page (so the normal place when in portrait mode).
    • ebosi
      ebosi almost 7 years
      @koenieee have you tried the solution below? Is it satisfactory?
    • koenieee
      koenieee almost 7 years
      Hi Ebo, Sorry I forget this post. I will update my question because it isn't clear
    • ebosi
      ebosi almost 7 years
      answer edited - see below
  • koenieee
    koenieee almost 7 years
    Thank you for trying to answer my question, but I think you didn't understand it. I added a drawing on paper to clarify my question.
  • ebosi
    ebosi almost 7 years
    @koenieee thanks for pinging. Could you please draw the boundaries of your included landscpape pdf on your drawing, as well as how is text written in this document (horizontally, or vertically) - so that I'm sure I understand it correctly?
  • ebosi
    ebosi almost 7 years
    @koenieee plus: does "title" belong to the imported PDF, or the one you're trying to create? and are your PDF more than 1 page long?
  • koenieee
    koenieee almost 7 years
    Title doesn't beolong to the imported PDF, and yes the PDF is more than 1 page long. Only at the first page the title has to be visible (imported PDF), at the second page (PDF) only the page numbers has to be visible.
  • ebosi
    ebosi almost 7 years
    @koenieee is the proposed solution satisfactory?
  • koenieee
    koenieee almost 7 years
    No ebo, I'm sorry. The page numbers are on the left side of the page, not at the bottom, so that's something that is not going to work for me. But thanks for helping out! I will follow the link you posted