Feeds:
Posts

Merge PDF files using LaTeX

During the past few years, I have become a fan of LaTex. I write documents using LaTex whenever possible for ease of formatting, inserting images and version control.

Today I’ve found an easy way to merge PDF files using LaTex. Suppose I want to attach the first three pages of file2.pdf to the end of file1.pdf and thus create a new PDF file, we can use the LaTex source below and compile it with pdflatex:

\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\includepdfmerge{file1.pdf,-}
\includepdfmerge{file2.pdf,13}
\end{document}

By now I’ve found two natural but minor limitations of this approach: (1) it cannot properly handle bookmarks and (2) it will not intellegently update the page numbers shown in pagefoot.