Split PDF with Zero padding  SOLVED

This Forum is for the use of End Users requiring help and assistance for Tracker Software's PDF-Tools.

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Stefan - PDF-XChange

dasy2k1
User
Posts: 77
Joined: Mon Feb 15, 2016 10:55 am

Split PDF with Zero padding

Post by dasy2k1 »

Hi I need to split some large multi page PDFs into one page files
the Merge/split tool seems to do this fine (split every 1 page) with one issue,
the ouput is

filename-1.pdf
filename2.pdf
.....
filename-9.pdf
filename-10.pdf
.....
filename-99.pdf
filename-100.pdf
and so on

the problem is that I then need to feed the output into another script that cant cope correctly with these names and reads them in the order
1, 10, 100, 101, 102..... 109, 11, 110, 111, 112 .... 119, 12, 120 .... 19, 191 ... 199, 2, 20, 200, and so on. which isnt helpful

what i want to do is name the output files with sufficient zero padding to cover the number of pages.

so i get
filename-001.pdf
filename-002.pdf

but i cant figure out what setting i need to do to get this
User avatar
Ovg
User
Posts: 470
Joined: Tue Sep 05, 2017 4:56 pm

Re: Split PDF with Zero padding  SOLVED

Post by Ovg »

Снимок.PNG
or use %[FileName]-%[Page:3]

https://help.pdf-xchange.com/pdfxe7 ... os_ed.html
You do not have the required permissions to view the files attached to this post.
It's impossible to lead us astray for we don't care even to choose the way.
PDF-XChange PRO, 10.1.1 (Build 381) / W7 SP1 x64
dasy2k1
User
Posts: 77
Joined: Mon Feb 15, 2016 10:55 am

Re: Split PDF with Zero padding

Post by dasy2k1 »

Thanks for that, its working well enough for now

be nice though if there was an automatic way of getting the right number based on the %[pages] value so 1-9 gives :1 10-99 gives :2 100-999 gives :3 1000-9999 gives :4 and so on automatically
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19930
Joined: Mon Jan 12, 2009 8:07 am

Re: Split PDF with Zero padding

Post by Stefan - PDF-XChange »

Hello Dasy,

Glad to hear that OVG's suggestion works for you.
Unfortunately there isn't such an "auto add the necessary number of leading zeroes" macro.

Regards,
Stefan
User avatar
Vladimir G - Tracker Dev
User
Posts: 92
Joined: Thu Nov 30, 2017 1:24 pm

Re: Split PDF with Zero padding

Post by Vladimir G - Tracker Dev »

Hello Dasy,
dasy2k1 wrote: Thu Jan 23, 2020 1:19 pm be nice though if there was an automatic way of getting the right number based on the %[pages] value so 1-9 gives :1 10-99 gives :2 100-999 gives :3 1000-9999 gives :4 and so on automatically
If you will use this macro for filename(without explicit setting number of digits): "%[FileName]-%[AutoNumber]", Save Document tool will automaticaly choose number of digits for %[AutoNumber] based on amount of documents that you are saving.

For example, if you want to split document that have 100 pages by 1 page, you will get 100 output documents and %[AutoNumber] macro result will have 3 digits.
Vladimir
Software Developer
PDF-XChange Co. LTD
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 12501
Joined: Wed Jan 03, 2018 6:52 pm

Re: Split PDF with Zero padding

Post by Daniel - PDF-XChange »

Vmgoshko,
Thank you for the tip there! Dasy2k1, does this help with your case?
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com