I need to find a way to pad my page numbers with a single leading zero. The end user of Connect says they must have the following format for page numbering:
Page 01 of 02
Page 02 of 02
Is there any way to access these values from within a text script in Designer?
I don’t know about the access from a text script (other than manually keeping track using code). There is another way using the output creation settings.
LONG: If you go to the output creation settings under ‘file->print presets’ of your template and click Next (to Print Options), you can see the ‘Add text and barcodes’ checkbox. If you tick that checkbox, keep clicking Next untill you reach the ‘Text and Barcode Options’.
Here you have two choices, either add ‘Additional Text’ or ‘Additional Barcodes’. You’ll want to click the add button on the right hand side of the ‘Additional Text’ table. You will see a popup screen with some information about the position and font of the additional text, and of course the field where you can type some text to add.
Next to this field where you can type your additional text, you find another add button. If you click this, you get a few options, you’ll want to click ‘Info field’, from where you can choose ‘Document page number’. It will add ${page.nr} to your textfield. If you simply add a zero in front of this; 0${page.nr}, it will display the pagenumer with the padded zero. Then to have your total pages, simply click the add button again and click ‘Info field’ –> ‘Document pages’, which adds ${document.count.pages}. You can add a zero in front of this aswell.
SHORT:
Go to Output creation settings under ‘file->print presets’.
Click Next to Print Options. Tick the checkbox Add text and barcodes.
Click Next untill you reach Text and Barcode options.
Next to the ‘Additional Text’ table, click the add button.
Next to the ‘Text’ textfield, click the add button.
for the current pagenumber, click Info field -> Document page number
for the total page number, click Info field -> Document pages
Add the 0 in front of the variables as desired (see NOTE below).
NOTE: I’m assuming, since you’re adding the 0 to the page numbers, you possibly have double digit pagenumbers. You can use the ‘Condition’ parameters to switch between multiple additional textfields, where you check the number of total pages and the current page number in the conditions, so the right additional textfield gets added to the page. Either with a zero, or without.
In pseudo code:
if current page is smaller than 9 and pagecount is smaller than 9 –> 0${page.nr} of 0${document.count.pages}
if current page is smaller than 9 and pagecount is larger than 9 –> 0${page.nr} of ${document.count.pages}
if current page is larger than 9 and pagecount is larger than 9 –> ${page.nr} of ${document.count.pages}