Insert a PDF file inside a LaTeX document

In this tutorial, we will learn how to insert a PDF file all pages or some selected pages in a LaTeX document and insert a PDF file as an image or figure.

Insert a PDF file with all pages or selected pages

To Insert a PDF file in a LaTeX document, you can use the pdfpages package, this package provides a \includepdf command to insert a PDF file in LaTeX.

In order to add all pages of a PDF file you can use this command:

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

To add some pages or selected pages, you can use this:

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

This will insert 1 to 5 pages in your document and you can also insert only one page of a PDF file. Also, you can remove a page like this.

\includepdf[pages={1,2,4-6}]{file.pdf}

This will insert pages 1, 2, 4, 5, and 6 in your document. Also, you can use {} in [pages] to add blank pages.

\includepdf[pages={1,2,{},4-6}]{file.pdf}

This will insert page 1, 2, a blank page, 4, 5, and 6.

If you want to insert all pages in reverse order, you can use this command.

\includepdf[pages=last-1]{file.pdf}

Insert a PDF file as a figure or an image

If you want to insert a PDF file as a figure or image then you can use the \includegraphics[]{file.pdf} command provided by the graphicx package.

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}
    \centering
    \includegraphics[width=.5\linewidth]{Logo.pdf}
    \caption{Insert PDF as figure}
\end{figure}

\end{document}

Output:

insert pdf file in document.

Leave a Reply

Your email address will not be published. Required fields are marked *