13

Using XeLaTeX I am trying to add a PDF to my file. Only the first page the PDF is included in the output file.

The following MWE refers to a PDF I created using Apple's TextEdit and 'Save as PDF' from the Print dialog. The contents are simply: 'Page 1', 'Page 2' etc. on each page.

\documentclass{article}

\usepackage{pdfpages}

\title{Minimal Working Example}
\date{}
\author{Author}

\begin{document}
\maketitle

\section{Section 1}
Content

\includepdf{test-pdf}

\end{document} 
Pwdr
  • 857
  • 2
  • 8
  • 20

3 Answers3

16

According to the pdfpages documentation, this is the default behavior when including pdfs with \includepdf. In order to get all the pages, you need to type:

\includepdf[pages=-]{test-pdf}
Mario S. E.
  • 18,609
2

I've observed the issue you describe even with the [pages=-] option provided. pdflatex worked as expected, but xelatex only included the first page, and even failed with an error if I explicitly set the page range to include the second page of my multi-page PDF:

Package pdfpages Error: page 2 of `142952.PDF' does not exist.

The issue turned out to be triggered by an upper-case file extension (i.e., .PDF) on a case-sensitive file system.

Changing the file name from 142952.PDF to 142952.pdf solved the problem with XeLaTeX. And of course, if the file extension is lower-case .pdf, it can also be omitted in the \includepdf argument.

0

In my case (Linux) it had problem when file contained . or - before .pdf. Renaming helped.

pevik
  • 167