Is there a command-line method to split a multi-page PDF file into single pages?

I have a single PDF file 6 pages long that I want to split into six seperate pdfs (1.pdf, 2.pdf, 3.pdf) such that each file produced represents one page from the input. I would love to be able to do this simple task from the command line.


Solution 1:

Open up the pdf in preview and then on the view menu select thumbnails. Ctrl select the pages that you want now drag and drop them to the desktop.

Solution 2:

This can be achieved by using pdfseparate. You can install poppler with homebrew, by brew install poppler. This will also install pdfseparate. To split the PDF document.pdf into into single pages 1.pdf, 2.pdf, etc. use:

pdfseparate document.pdf %d.pdf

Solution 3:

If you're interested in doing this from the command line, you can look at Benjamin Han's splitPDF python script to do the job. For instance:

splitPDF.py in.pdf 3 5

would split the file in.pdf into 3 files, splitting at pages 3 and 5.

Solution 4:

For another alternative, see this answer. This uses the ImageMagick command line tools.

convert x.pdf -quality 100 -density 300x300 x-%04d.pdf

However, you have to be careful with the quality.