The pdfpages package
Inserts whole pages of another PDF file into the document with \includepdf, one or several per sheet.
Loading the package
\usepackage{pdfpages}\includegraphics places a PDF page as an image inside the text area. \includepdf gives each inserted page a page of its own and ignores the margins, so a scanned form, a signed declaration or a paper for the appendix keeps its original size.
Without options the command inserts the first page only. pages=- inserts all pages, pages={1,3-5} a selection. The inserted pages have no header and no page number unless you set pagecommand.
Main commands
\includepdf[pages=-]{figure.pdf} | Inserts all pages of the file. |
pages={1,3-5} | Page 1 and pages 3 to 5. |
nup=2x2 | Four pages on one sheet, in two columns and two rows. |
pagecommand={\thispagestyle{plain}} | Runs on every inserted page; here it prints the page number of the main document. |
scale=0.9, frame | Shrinks the pages to 90 % and draws a frame around each. |
landscape | Turns the sheet by 90° for pages in landscape format. |
addtotoc={1,section,1,Title,label} | Adds a table-of-contents entry for page 1: level section, depth 1, a title and a label. |
Complete example
\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\section{Appendix}
The following pages come from another PDF file.
% all pages, each on a page of its own
\includepdf[pages=-]{figure.pdf}
% the first page twice on one sheet, with a frame and a page number
\includepdf[pages={1,1}, nup=1x2, frame, scale=0.9,
pagecommand={\thispagestyle{plain}}]{figure.pdf}
\end{document}Compiled with pdfLaTeX from TeX Live 2023.
Pitfalls
- A page number that the file does not have gives the error "Page 3 of ... does not exist".
- For a file newer than PDF 1.5, pdfLaTeX warns "PDF inclusion: found PDF version <1.7>, but at most version <1.5> allowed". The pages are inserted anyway.
\pdfminorversion=7before\documentclassremoves the warning. - A
\sectiondirectly before\includepdfstays alone on its page, because the inserted page always starts a new one.addtotoccreates the entry in the table of contents without a visible heading.
Related pages
- How-to Include PDF pages in LaTeX
- How-to Add an appendix in LaTeX
- Package
graphicx - Package
pdflscape