'pdfseparate': Format output file name as page number with leading zeroes

pdfseparate requires to specify %d as PDF-page-pattern which is replaced by the page number.

$ pdfseparate CFL_1115_ISSUU.pdf cfl-%d.pdf works. It sets separated output file names as cfl-1.pdf, cfl-2.pdf, ..., cfl-10.pdf etc.

Now I need to add leading 0 to fix the file name string length. So when I try to use formatting characters in command $ pdfseparate CFL_1115_ISSUU.pdf cfl-%04d.pdf, it gives error Syntax Error: 'cfl-%04d.pdf' must contain '%d' if more than one page should be extracted

Can anybody suggest if such formatting is possible?

1

1 Answer

On my system (Mac OS X), using the most recent version of Poppler, v0.42.0, this command works as expected:

$ pdfseparate -l 10 PDF32000_2008.pdf cfl-%04d.pdf
$ ls -l cfl-*.pdf
-rw-r--r-- 1 kp staff 11475 23 Mär 18:58 cfl-0001.pdf
-rw-r--r-- 1 kp staff 91252 23 Mär 18:58 cfl-0002.pdf
-rw-r--r-- 1 kp staff 8334441 23 Mär 18:58 cfl-0003.pdf
-rw-r--r-- 1 kp staff 8334443 23 Mär 18:58 cfl-0004.pdf
-rw-r--r-- 1 kp staff 8334444 23 Mär 18:58 cfl-0005.pdf
-rw-r--r-- 1 kp staff 93209 23 Mär 18:58 cfl-0006.pdf
-rw-r--r-- 1 kp staff 89540 23 Mär 18:58 cfl-0007.pdf
-rw-r--r-- 1 kp staff 64383 23 Mär 18:58 cfl-0008.pdf
-rw-r--r-- 1 kp staff 8334444 23 Mär 18:58 cfl-0009.pdf
-rw-r--r-- 1 kp staff 116229 23 Mär 18:58 cfl-0010.pdf
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like