Created
June 20, 2011 12:30
-
-
Save ppanyukov/1035536 to your computer and use it in GitHub Desktop.
Combine several PDF files into one using LaTeX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Many a time we have HTML articles published across multiple pages. | |
% And sometimes we want to print all those pages as one PDF. | |
% Here is how to do it: | |
% - Print into PDF from the browser into files like p01.pdf, p02.pdf etc | |
% - Use LaTeX to assemble these into one PDF. | |
% | |
% Here is the example. The \includepdf command supports scaling too, | |
% and I'm sure some other interesting commands as well. | |
% | |
% [copylifted from: http://yusung.blogspot.com/2007/02/combine-several-pdf-files-using-latex.html] | |
% thanks! | |
% | |
\documentclass[a4paper]{article} | |
\usepackage{pdfpages} | |
\begin{document} | |
\includepdf[pages=-, scale=0.9]{p01.pdf} | |
\includepdf[pages=-, scale=0.9]{p02.pdf} | |
\includepdf[pages=-, scale=0.9]{p03.pdf} | |
\includepdf[pages=-, scale=0.9]{p04.pdf} | |
\end{document} |
use this then:
% this sets global options for each \includepdf call
% (altho only options specific to pdfpages package can be made global by \includepdfset.)
\includepdfset{pages=-,fitpaper}
% include each document
\includepdf{p01.pdf}
\includepdf{p02.pdf}
% you could add document specific options as well i did here
\includepdf[pages=5-]{p03.pdf}
\includepdf{p04.pdf}
% reset default global settings
\includepdfset{}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The drawback here is if the pdf contains pages with different sizes then it will not consider that