5

I'm using pdfpages to put a PDF file into my latex document. The command

\includepdf[page=1,angle=90,height=\textheight]{file.pdf}

works fine but I would rather it kept the header and footer that are on every other page in the document and then had the PDF file fill in the remainder of the page. As is it kills the header and footer.

Maybe I should construct a box?

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
Andrew
  • 105
  • 2
    Welcome to TeX.SX! You don't need \includepdf; \includegraphics is sufficient and it wouldn't override the page style. – egreg Jan 27 '14 at 22:30

2 Answers2

7

The following example centers an image in the text area of a new page. The image is maximized without distortion:

\documentclass{article}
\usepackage{graphicx}

\newcommand*{\IncludePageImage}[2][]{%
  \newpage
  \begingroup
    \centering
    \setlength{\parskip}{0pt}%
    \setlength{\topskip}{0pt}%
    \nointerlineskip
    \vspace*{\fill}%
    \includegraphics[%
      width=\textwidth,
      height=\textheight,
      keepaspectratio,
      #1%
    ]{#2}%
    \par
    \vspace*{\fill}%
    \newpage
  \endgroup
}

\begin{document}
  \IncludePageImage{file.pdf}
\end{document}

The page layout can be made visible by option showframe of package geometry:

\usepackage[pass,showframe]{geometry}

Option pass is useful, if the layout is defined without package geometry. Then package geometry lets the layout parameter untouched if option pass is given.

Heiko Oberdiek
  • 271,626
1

Thanks everybody. I ended up using

\includepdf[page=1,angle=90,height=\textheight,pagecommand={\pagestyle{fancy}}]{file.pdf}

but all the other info is great for the future.

Andrew
  • 105