Combining PDF files revisited

Dec 09, '02 08:21:19AM

Contributed by: Miga

This is a follow-up to this older hint. I've tried that hint, but was unable to create a PDF file with it.

[Editor's note: I have not tested the following process myself.]

So, what I do now is the following:

  1. Get Latest TeXShop and II2.dmg from the TeXShop home page.

  2. Install them as explained on the TeXShop TeXShop installation page. Now you have a fully functional TeX installation working on OS X with GUI (and also in the terminal if you want).

  3. Say you have three pdf files named file1.pdf, file2.pdf, file3.pdf, which contain respectively 10 pages, 8 pages, 7 pages. The first file is located on the ~/Desktop, the second one in ~/Documents and the third one on another volume in a directory named 'mypdf.' And while we're at it, you want to include a JPEG file which will be enlarged to 4 inches. This last file is located in ~/pictures and named 'myjpg.jpg.'

  4. Open TeXShop and type in the window the following text:
    \documentclass[11pt,a4paper]{article}
    % Allow jpg, pdf graphics inclusion
    \usepackage{graphicx}
    % Allow whole page pdfs to be imported
    \usepackage[final]{pdfpages}
    \begin{document}
    \includepdf[pages={1-10}]{/Users/yourloginname/Desktop/file1}
    \includepdf[pages={1-8}]{/Users/yourloginname/Documents/file2}
    \includepdf[pages={1-7}]{/Volumes/yourvolume/mypdf/file3}
    \includegraphics[width=4in]{/Users/yourloginname/Pictures/myjpg}
    \end{document}

  5. Click on Latex button and you'll be done (if there is no error in the console window; TeXshop apparently does not like empty pages).
The new PDF is created in ~/Documents, but you can change the default location. This way, you can extract pages from a pdf with:
 \includepdf[pages={4-7}]{file1}
(extract pages 4 to 7) or:
 \includepdf[pages={4,7}]{file1}
(extract page 4 and page 7). You can also merge PDF files partially.

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20021209052119749