twidizle
twidizle

Reputation: 1535

Programatically splitting pdf pages to their own pdf's in UNIX

I am trying to write a program that takes as input a .pdf file and separates each page into their own .pdf files in UNIX command line. I have tried SplitPdf but for some reason I keep getting errors.

update: I have already tried pdftk but it has poor performance and a limitation on the size of the pdf file.

Upvotes: 3

Views: 1880

Answers (1)

Orbling
Orbling

Reputation: 20602

Use pdftk.

The burst command is what you are after.

Man page section: http://www.pdflabs.com/docs/pdftk-man-page/#dest-op-burst

burst

Splits a single, input PDF document into individual pages. Also creates a report named doc_data.txt which is the same as the output from dump_data. If the output section is omitted, then PDF pages arenamed: pg_%04d.pdf, e.g.: pg_0001.pdf, pg_0002.pdf, etc. To name these pages yourself, supply a printf-styled format string in the output section. For example, if you want pages named: page_01.pdf, page_02.pdf, etc.,pass output page_%02d.pdf to pdftk.

Encryption can be applied to the output by appending output options such as owner_pw, e.g.: pdftk in.pdf burst owner_pw foopass

Upvotes: 2

Related Questions