How to combine pdf documents with Latex

PDF is a file format that is widely used for file exchange. One may need to combine multiple PDF documents in one file for example: consolidate multiple documents scanned separately into one PDF file, or attach certificates and supporting documents to your CV to make one PDF for job application.

It is possible to create PDF documents in Latex using the PdfLatex or dvi2ps then ps2pdf. In case you want to combine multiple documents in one PDF file, you can make use of the package "pdfpages" (you can download it for free from the  Latex repository if not yet installed with your latex system).

The simple example below, shows how to create a Latex document (article) in which external PDf files are included using the command \includepdf. Example:
\includepdf{somefolder/file1.pdf}
to include file1.pdf located in sub-folder somefolder.

You may also include only selected pages from external documents. Example:
\includepdf[pages={2-3}]{anotherfolder/onlyincludepartially.pdf}
to include pages 2 to 3 from  onlyincludepartially.pdf located in sub-folder anotherfolder.

There are other options available with the package. See the accompanying documentation.

The full Latex example is as follows.


\documentclass{article}
\usepackage{pdfpages}

\begin{document}

Here is the introduction to \emph{some kind of notebook}.

\includepdf{somefolder/file1.pdf}

Here's maybe some text in between.

\includepdf[pages={2-3}]{anotherfolder/onlyincludepartially.pdf}

And here might be some end-notes.
\includepdf[pages=-,pagecommand={},width=\textwidth]{file.pdf}


\end{document}

Comments