9

I am using the pdfpages package to include a PDF document as appendix into my main latex document as follows:

\usepackage{pdfpages}
\includepdf[pages=-]{myfile.pdf}

In general, this approach works but I have the following issues:

  • The page orientation of the pages of the included PDF file vary: some are portrait and some are landscape. When including the PDF like described above all included pages have portrait orientation. Is it possible to use the original orientation of each included page?
  • The pages of the Latex PDF document are numbered. The pages of the included PDF are not numbered. Is it possible to continue the normal numbering also for the included pages?

Thanks!

Jonas
  • 2,974
  • 4
  • 24
  • 23
  • I am also seeing the first point you bring up: the orientations of the included pages are all set to the orientation of the first page, resulting in scaling. This is even the case when I use the `fitpaper` option. Did you ever find a way to preserve this orientation through the `\includepdf` macro? See also: https://tex.stackexchange.com/questions/563042/pdfpages-not-scaling-the-pdf-when-fitpaper-is-true – Alex Hirzel Dec 19 '22 at 20:08

2 Answers2

10

To continue normal numbering:

\includepdf[pages=-,pagecommand=\thispagestyle{plain}]{myfile.pdf}
Tom Solid
  • 2,226
  • 1
  • 13
  • 32
1

I wanted to answer the part about preserving page orientations. The following macro is a trick that uses the pagetemplate argument to have per-included-page sizing. It may be possible to refactor this to not require the pgffor dependency.

\usepackage{pdfpages}
\usepackage{pgffor}

\newcommand{\includepdfReally}[1]{%
\foreach \n in {1,...,\XeTeXpdfpagecount{#1}}{%
\includepdf[fitpaper,pages=\n,pagetemplate=\n]{#1}}}

This works in XeLaTeX and relies on an engine-specific macro \XeTeXpdfpagecount. There are analogous macros for other engines.

Alex Hirzel
  • 1,719
  • 2
  • 12
  • 18