Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Let's say I have created a 100-page book with the book document class.

What is the quickest way to extract, say, pages 3, 67-70, and 80 from the book into six separate PDF files? Is there any standard tool/script out there that does this very quickly?

Manually doing this through a UI is rather tedious.

share|improve this question
    
You may also want to look at this tool: pdfShuffler –  kan Oct 29 '12 at 23:28

3 Answers 3

up vote 10 down vote accepted

You can use the pdfjam tool with the syntax

pdfjam <input file> <page ranges> -o <output file>

and an example of page ranges would be

3,67-70,80

to extract page 3, pages 67 to 70 and page 80, and put these pages into a single document. Note however that this will break the hyperlinks in your document.

[edit] pdfjam is actually a front end for pdfpages, suggested in an other answer.

You could also use pdfseparate from poppler to burst a document into separate pages. Using

pdfseparate <document> 'page_%d.pdf'

using the result of pdfjam as a document will give you files named page_1.pdf … page_6.pdf containing all the desired pages.

share|improve this answer
    
This works! (Except that <page ranges> goes after <input file>.) However, how do I split the final output file into various one-page PDF files? –  MayGodBlessKnuth Oct 29 '12 at 22:22
    
My new edition takes your comment into account. –  Vincent Nivoliers Oct 29 '12 at 22:25

You can do this with the pdfpages package.

Code:

\documentclass{article}
\usepackage{pdfpages}

\begin{document}
    \includepdf[pages={3,67-70,80}]{<pdf-file>}
\end{document}
share|improve this answer

You can perform lots of tasks with pdf files using pdftk. For example,

pdftk big_file.pdf cat 3 output page3.pdf

creates a new file page3.pdf from page 3 of big_file.pdf. You can also use ranges; replacing 3 with 67-70 extracts pages 67-70.

share|improve this answer
    
If I remember right there's also a burst directive to split it into single page files. –  Loop Space Oct 30 '12 at 8:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.