Formating numbers rules for PageLabels

Post Reply
Aristide
Newbie
Posts: 13
Joined: Tue Feb 11, 2025 3:05 pm

Formating numbers rules for PageLabels

Post by Aristide »

Hello,
Thank you for this forum.
Sorry if this question has already been asked but I don't find any simple solution here or in the Switch Guide.

After a split PDF app, I use the RenameJob app with this "Single line with variable" :
[Job.PrivateData:Key="theCode"]_[Stats.PageLabels]_[Job.PrivateData:Key="stringAfterPages"]

I need 3 digits in the PageLabels number (no pdf with more than 999 pages !) but don't find formating options for numbers...

Is there a switch fonction for formating numbers in a "Single line with variable" like it exists for dates :
[Switch.Date:TimeZone="UTC",Format="yyyy-MM-dd"]

Thank you very much for your help

AF
User avatar
tdeschampsBluewest
Member
Posts: 153
Joined: Tue Jun 01, 2021 11:57 am

Re: Formating numbers rules for PageLabels

Post by tdeschampsBluewest »

Hi AF,

In the Split PDF tool, you can actually do this automatically no need to use a Rename Job after!

In the Prefix / Suffix properties, you can set up some built-in variables. They add the correct number of leading 0 as needed.
Note that other variables like Private Data do not work in those properties.

Here’s a quote from the documentation:
[Index] The one-based index (in the original file) of the first page stored in this result file.
[LastIndex] The one-based index (in the original file) of the last page stored in this result file.
[Label] The PDF page label of the first page stored in this result file. If the page does not have a label, its one-based index is used.
[LastLabel] The PDF page label of the last page stored in this result file. If the page does not have a label, its one-based index is used.
[LastSourceLabel] The PDF page label of the last page in the original file. If the page does not have a label, its one-based index is used.
[Total] The total number of pages in the original file.
So basically, in your case, use [Label]_ as a prefix in the Split PDF tool, then use a Rename Job (if needed) to add a second prefix with [Job.PrivateData:Key="theCode"]_


In addition, if you want to add leading 0 for some other case (or if you have two digit pdf, and always want it on 3 digit), you can use the rename action "Add leading 0", you'll just need a regex to catch the correct pattern, in this case something like ^\d+
Do you like the Enfocus Apps developed by Bluewest?
Feel free to leave a comment on the Appstore!
Aristide
Newbie
Posts: 13
Joined: Tue Feb 11, 2025 3:05 pm

Re: Formating numbers rules for PageLabels

Post by Aristide »

Bonjour Thierry,
thank you for your answer.

The original file name contains the first and last pages numbers in the middle of the name, and I want to remove this information from the renamed PDFs
So, I split pages of a multipages PDF then I rename each pages because I need to keep only the Label with specific Private Datas as prefix and suffix.

I need practice because it's not as simple as I thought.
I thought a calculation was possible and might be enough. For example, concatenate "000" and PageLabels while keeping only the last 3 characters...
And to use this calculation in the Rename Job with Variables.

I need training... The split Pages is not really clear at all for me...


Thank you !

AF
Post Reply