The **pdfpages** package (by Andreas Matthias) drops pages from an *existing* PDF file straight into the document you are typesetting. Prepend a cover or a signed form, splice separate PDFs into one thesis, lay slides out 2×2 for a handout — all without the margin overflows you get from a bare \includegraphics. It revolves around a single command, **\includepdf[⟨options⟩]{file.pdf}**.
Basic usage
Load \usepackage{pdfpages} in the preamble, then call \includepdf in the body. The smallest example is below; it inserts every page of cover.pdf, each scaled to fill the sheet with no surrounding margin. The filename in the argument must not contain blanks.
\documentclass{article}
\usepackage{pdfpages}
\begin{document}
% 本文…
\includepdf[pages=-]{cover.pdf}
% …続きの本文
\end{document}Internally \includepdf calls \includegraphics from the graphicx package, so any option pdfpages does not interpret itself (trim, clip, scale, and the like — see below) is passed straight through to \includegraphics. By default each page is scaled automatically to fit the sheet.
The official manual (v0.6g) lists the supported engines as pdfTeX, VTeX, XeTeX, LuaTeX, and pTeX — so it works under pdfLaTeX, LuaLaTeX, XeLaTeX, and (up)pLaTeX alike. It assumes an engine that writes PDF directly, though: **on a DVI-output route the PDF cannot be imported, and pdfpages inserts blank pages instead.** The pLaTeX + dvipdfmx setup common in Japanese work therefore needs the dvipdfmx driver wired up (next section).
Choosing which pages (pages)
The most important option is **pages**. It takes a comma-separated list naming the pages to insert and their order. Its default is pages=1 (the first page only), so you must set it whenever you want more than that.
| You write | Effect | Pages inserted |
|---|---|---|
pages=- | Every page, in order | All pages of the inserted PDF |
pages={1,3,5} | Just the pages you list | Pages 1, 3 and 5 |
pages={2-8} | A range | Pages 2 through 8 |
pages={3,{},15} | A blank page via {} | Page 3, a blank page, then page 15 |
pages=last-1 | Reverse order | Last page down to the first (last = final page) |
pages={1-3,5,{},7} | Mix and match | A range, singles and a blank, combined |
A range is written ⟨m⟩-⟨n⟩. Omit m and it means the first page; omit n and it means the last. So pages=- reads as “first to last,” i.e. all of them. The final page can also be named with the keyword last (only inside a range). A blank page is just an empty {} — handy for slipping one white leaf between a cover and the body.
% 表紙の次に白ページ、そのあと本文 1–20 ページ
\includepdf[pages={1,{},2-21}]{thesis-cover.pdf}
% 全ページを逆順で
\includepdf[pages=last-1]{scan.pdf}The main options
Every option uses the ⟨key⟩=⟨value⟩ form, listed comma-separated inside the brackets of \includepdf. For boolean options (such as frame), omitting the value means “true.” The ones you reach for most:
| Option | What it does (default) | Use for |
|---|---|---|
nup | Put several pages on one sheet (n-up). nup=2x2 = 2 across × 2 down. Default 1x1 | Handouts, reduced printing |
frame | Draw a frame around each page (default false) | Show each page’s edge |
delta | Gap between tiled pages. delta=⟨x⟩ ⟨y⟩ (default 0 0) | Space between n-up pages |
landscape | Rotate the sheet 90° to landscape (default false) | Wide PDFs, booklets |
scale | Scale factor; passed to graphicx (use with noautoscale) | Set the size yourself |
fitpaper | Make the output paper match the inserted PDF’s size (default false) | Keep the original page size |
offset | Shift the page position. offset=⟨x⟩ ⟨y⟩ (default 0 0) | Tweak for binding |
pagecommand | Code run on every inserted page (default \thispagestyle{empty}) | Add page numbers / headers |
link / linkname | Make inserted pages a hyperlink target / rename it (default false) | Make pages clickable |
nup (n-up imposition)** tiles several logical pages onto one sheet. The syntax is nup=⟨across⟩x⟨down⟩. By default pages fill row by row; add column for a column-major order, and columnstrict to keep that order strict even on the last sheet. Pair it with delta for gaps between pages and frame to box them. Note that landscape rotates only the sheet (to spin the pages themselves use angle=90).
pagecommand** names LaTeX code to run on each inserted page. The default is pagecommand={\thispagestyle{empty}} (no page numbers or the like). Switch it to pagecommand={\thispagestyle{plain}} and your document’s page numbers appear on the imported PDF too. It is also the entry point for overlaying headers, footers, or a watermark.
You can also use **trim and clip** from \includegraphics (any option pdfpages does not recognise is forwarded there) — handy for cropping the header and footer off the pages you import. For example: \includepdf[pages=-, trim=0 2cm 0 2cm, clip]{paper.pdf}.
Worked examples
Make a handout — lay a slide PDF out four-up (2×2) per sheet, box each page, and leave a gap between them.
\includepdf[pages=-, nup=2x2, frame, delta=5mm 5mm]{slides.pdf}Splice several PDFs together — to assemble separate files into one document, use **\includepdfmerge**. Its argument is a list of “filename, page-spec, filename, page-spec, …”. The page-spec uses the same syntax as pages; omit it and only that file’s first page is inserted.
% a.pdf の 1–2 ページと b.pdf の 3 ページ目をこの順に
\includepdfmerge{a.pdf, 1-2, b.pdf, 3}
% 学位論文を別々の章 PDF から組み立てる
\includepdfmerge{frontmatter.pdf, -, chap1.pdf, -, chap2.pdf, -}\includepdfmerge accepts the same options as \includepdf (using the page-spec above in place of pages). To avoid repeating the same options, set defaults once with **\includepdfset{⟨options⟩}**; options given on an individual \includepdf override them.
Impose a booklet — a saddle-stitched booklet needs its pages reordered into folding sequence. pdfpages has a **signature** option: give it a multiple of 4 and it rearranges pages into signatures, laying them out with nup=2x1 automatically. A quick pages=-, nup=1x2, landscape will put two pages side by side, but does *not* reorder them for folding. For full booklet imposition you can also use the **booklet** package.
% 縦長の文書を 8 ページ折丁の冊子に
\includepdf[pages=-, signature=8, landscape]{booklet-doc.pdf}Japanese & driver notes
Support for the pTeX family (pLaTeX / upLaTeX) arrived in pdfpages v0.5a. These write DVI and turn it into PDF via dvipdfmx, so importing the PDF is **dvipdfmx’s job**. As long as the graphics driver is chosen correctly, \includepdf works as-is. If pages come out blank, revisit the driver setting (pass dvipdfmx as a class/global option, or state \usepackage[dvipdfmx]{graphicx} explicitly).
One behaviour to remember: only each page’s content (its appearance) is copied — links and annotations inside the source PDF are lost. To keep links you need a helper such as the pax package. Also, if you set a page background with \pagecolor, the first \pagecolor must come before \usepackage{pdfpages}.