1

How can you pick pages from a PDF file?

Pseudo-code synopsis

 pick-pages 1,2-69,70-73,100 example.pdf > put_to_new_file.pdf
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697

6 Answers6

4

My best suggestion would be to try something with PDF toolkit - with Split and Merge, and a simple .bat file construction, something like that shouldn't be much hard.

Thomas Geritzma
  • 6,337
  • 6
  • 25
  • 19
2

ghostscript, somethign like

gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dFirstPage=3 -dLastPage=3 -sOutputFile=fileout.pdf filein.pdf
Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
1

This is how I've done it with regular expressions. I counted the number of matches for the following regular expressions:

/Type\s*/Page[^s]

Case insensitive, by the way.

David Andres
  • 31,351
  • 7
  • 46
  • 36
0

You're after pdftk.

Peter
  • 127,331
  • 53
  • 180
  • 211
0

Probably this is not a popular method, but this is one way. You can use pdflatex. For example, you can write a tex like:

\documentclass{book}\usepackage{pdfpages}\begin{document}
\includepdf[pages={1,2-10,11}]{pdf.pdf}\end{document}

You can write a small script to automize this.

user172818
  • 4,518
  • 1
  • 18
  • 20
  • The best way is pdftk. The problem is installing pdftk from MacPorts requires to install a free JavaVM, which bugs me a bit. – user172818 Sep 15 '09 at 19:38
0

As part of my CAM::PDF Perl library on CPAN, I bundle a command-line utility deletepdfpage.pl that does the inverse of what you are asking for, with almost the exact same syntax:

deletepdfpage.pl original.pdf 74-99,101- target.pdf
Chris Dolan
  • 8,905
  • 2
  • 35
  • 73