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:
- Get Latest TeXShop and II2.dmg from the TeXShop home page.
- 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).
- 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.'
- 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}- Tip #1: It's not necessary to include the extension. If the extension is PDF, change it to pdf before using TeXshop.
- Tip #2: No space in file path (remove them before using TeXshop).
- Tip #3: No accent in file path (remove them before using TeXshop).
- Tip #4: Use English names for directories (Pictures and not Images for French users - you can view the English name with Command-I on the folder, then open the tab name and extension).
- 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