Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

split

pdf

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.

like image 258
twidizle Avatar asked Jan 26 '26 09:01

twidizle


1 Answers

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

like image 194
Orbling Avatar answered Jan 28 '26 04:01

Orbling



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!