Insert PDF in LaTeX: Embed PDF Pages and Documents

Date Published

Insert PDF in LaTeX: Embed PDF Pages and Documents

Inserting PDFs in LaTeX

Include external PDF files in your LaTeX document using the pdfpages package.

Quick answer: How do you include a PDF in LaTeX? To insert whole pages of a PDF, load \usepackage{pdfpages} and write \includepdf[pages=-]{file.pdf} (pages=- means all pages; pages={1,3-5} picks some). To place one PDF page inside your own page as a figure, load graphicx and use \includegraphics[width=\linewidth,page=1]{file.pdf}.

Include a PDF in LaTeX: \includepdf vs \includegraphics

\includepdf

\includegraphics

Package

pdfpages

graphicx

Result

Each PDF page becomes a full page of your document

The PDF page is an image inside your text

Pages

pages=- (all), pages={1,3-5}, pages=last

One page: page=2 (default: page 1)

Captions

No (use pagecommand for headings)

Yes, inside a figure environment

Use it for

Appendices, attached reports, merging PDFs

Plots and diagrams exported as PDF

This document uses both. It compiles as written with the example files from TeX Live's mwe package; replace them with your own PDF:

1\documentclass{article}
2\usepackage{graphicx} % \includegraphics (a PDF page as a figure)
3\usepackage{pdfpages} % \includepdf (whole PDF pages)
4\begin{document}
5\section{Results}
6\begin{figure}[htbp]
7 \centering
8 \includegraphics[width=0.6\linewidth, page=1]{example-image-a.pdf}
9 \caption{A PDF page placed as a figure.}
10 \label{fig:chart}
11\end{figure}
12
13\appendix
14% first page with a section heading on it, then the rest of the file
15\includepdf[pages=1, pagecommand={\section{Full report}}]{example-image-a4-numbered.pdf}
16\includepdf[pages=2-]{example-image-a4-numbered.pdf}
17\end{document}

Try this in Octree — free LaTeX editor with AI, compiles in your browser

The pdfpages Package

\usepackage{pdfpages}

This powerful package lets you include entire PDFs or selected pages.

Include Entire PDF

\includepdf[pages=-]{document.pdf}

The pages=- means all pages.

Include Specific Pages

Single Page

\includepdf[pages=1]{document.pdf}

Page Range

\includepdf[pages=1-5]{document.pdf}

Selected Pages

\includepdf[pages={1,3,5,7}]{document.pdf}

Last Page

\includepdf[pages=last]{document.pdf}

Exclude Pages

\includepdf[pages=-, nup=1x1, exclude={2,4}]{document.pdf}

Common Options

No Page Numbers

\includepdf[pages=-, pagecommand={}]{doc.pdf}

Add Page Numbers

\includepdf[pages=-, pagecommand={\thispagestyle{plain}}]{doc.pdf}

Landscape Pages

\includepdf[pages=-, landscape]{doc.pdf}

Scale PDF

\includepdf[pages=1, scale=0.8]{doc.pdf}

Offset Position

\includepdf[pages=1, offset=1cm 1cm]{doc.pdf}

Multiple Pages Per Sheet

2-up (2 pages per sheet)

\includepdf[pages=-, nup=2x1]{doc.pdf}

4-up (4 pages per sheet)

\includepdf[pages=-, nup=2x2]{doc.pdf}

With Frame

\includepdf[pages=-, nup=2x2, frame]{doc.pdf}

Adding to Appendix

Common pattern for appendices:

\appendix \section{Supplementary Material} \includepdf[pages=-]{supplement.pdf}

PDF as Figure

Include a single PDF page as a figure:

\begin{figure}[h] \centering \includegraphics[width=0.8\textwidth, page=1]{doc.pdf} \caption{First page of external document} \end{figure}

Note: Use includegraphics (not includepdf) for figures. The page= option selects which page.

Combining Documents

Merge multiple PDFs:

\includepdf[pages=-]{doc1.pdf} \includepdf[pages=-]{doc2.pdf} \includepdf[pages=-]{doc3.pdf}

Adding Headers/Footers

\includepdf[pages=-, pagecommand={ \begin{tikzpicture}[remember picture, overlay] \node at (current page.north) [below=1cm] {Header Text}; \end{tikzpicture} }]{doc.pdf}

Requires tikz package.

Troubleshooting

PDF not found: Check path, must be relative to main .tex file

Blank pages: Try \includepdf[fitpaper=false]

Wrong orientation: Use landscape or rotateoversize=false

Margins cut off: Use noautoscale, scale=0.9

Complete Example

\documentclass{article} \usepackage{pdfpages}

\begin{document}

\section{Introduction} Main content here.

\section{Attached Documents} See the following pages for the complete report.

\includepdf[pages=-, pagecommand={\thispagestyle{plain}}]{report.pdf}

\end{document}

Include PDF in LaTeX FAQ

How do I import a PDF into a LaTeX document?

Upload the PDF next to your .tex file, add \usepackage{pdfpages} to the preamble and write \includepdf[pages=-]{file.pdf} where the pages should appear. Compile with pdfLaTeX, XeLaTeX or LuaLaTeX.

Can \includegraphics include a PDF?

Yes. With graphicx, \includegraphics{file.pdf} inserts the first page of the PDF as an image, and the page= option picks another page: \includegraphics[width=\linewidth,page=3]{file.pdf}. This is the best way to include vector plots exported from Python, R or MATLAB.

How do I include only some pages of a PDF?

Pass a page list to pdfpages: \includepdf[pages={1,3-5,last}]{file.pdf}. Use pages=2- for page 2 to the end, and pages={} inside the list to insert a blank page.

How do I keep page numbers on included PDF pages?

pdfpages uses an empty page style by default. Add pagecommand={\thispagestyle{plain}} to number the pages, and scale=0.9 if the number would overlap the PDF content.

Include PDFs with Octree

Octree handles PDFs easily:

- Simple PDF inclusion - Real-time preview - AI helps with formatting - Export combined document

Try it at https://useoctree.com

Try this in Octree — free LaTeX editor with AI, compiles in your browser