2

On OSX, how can I extract a sequence of pages from a PDF into a single file using the command line? I see that there are commands to split a PDF into separate pages... but I'd like to specify a page range (e.g. pages 24-31) and output a single PDF file.

incandescentman
  • 6,168
  • 3
  • 46
  • 86
  • Crude way: Split it to separate pdfs & then combine the required ones... http://stackoverflow.com/questions/2507766/merge-convert-multiple-pdf-files-into-one-pdf – anishsane Dec 11 '15 at 04:30
  • 1
    See if this works: http://askubuntu.com/questions/221962/how-can-i-extract-a-page-range-a-part-of-a-pdf I believe OSX would have ghostscript... – anishsane Dec 11 '15 at 04:33

1 Answers1

2

With the pdfbox command line utilities of the pdfbox-app jar file:

http://pdfbox.apache.org/download.cgi

http://pdfbox.apache.org/2.0/commandline.html

java -jar pdfbox-app-x.y.z.jar PDFSplit -startPage 24 -endPage 31 yourfile.pdf 

A result file named yourfile-1.pdf will be created.

Tilman Hausherr
  • 17,731
  • 7
  • 58
  • 97