Upland OL User community

Adding page numbers to PDF


Is there a way to convert Page Number to letter in the Designer? We are trying to dynamically create a barcode sequence using the current page number.

Each PDF is a single record and we are recording the records in a database. In addition we will be using the Merge Jobs Connect Plugin to concatenate all the records. This means we can’t use the output preset to add page numbering or to create the barcode sequence that we want as the pages from various PDF will have all been merged.

For example, based on a 5 page PDF, the page numbering would be

"Page BNKCONREF X__A__ ",


“Page BNKCONREF X__C__”,

“Page BNKCONREF X__D__”,


I have tried to use the page number {#} in a script to no avail.

Is there a way I can address this in the Designer on a per “current page” basis?

Many thanks,


Hi Steve,

Add a extract step to your data mapper. Call the field whatever you want. Make sure its mode is set to JavaScript. Add the following code to the expression box/javascript editor.

function numToChar(n) {
var charA = ‘A’.charCodeAt(0);
var charZ = ‘Z’.charCodeAt(0);
var len = charZ - charA + 1;

var s = "";
while(n >= 0) {
    s = String.fromCharCode(n % len + charA) + s;
    n = Math.floor(n / len) - 1;
return s;

numToChar(record.index - 1);

You can now use this field to add the letters to whatever string you are building.



Hi Sharne,

Thank you for this but I’m nowhere closer to the solution. Remember that although my PDFs have multiple pages, my data mapper is always a single record in this case as I need to record all the records in a database.

Any other ideas?

Many thanks,

Rod had made a suggestion on a different post regarding the current page concept in Connect Designer but I can’t seem to find it.

I need to find a way to access the current page index in Connect Designer.

Any other suggestions would be very appreciated.



Ok, you will need a Post-Pagination script. Try the below:

  1. Add a Master Page
  2. On the Master Page, add a positioned box and type: Page BNKCONREF X{#}
  3. Give the positioned box a CSS class of “mypagecount” (without the quotes)
  4. Right-click on the Section and go to Sheet Configuration… and make sure the above master page is applied to all pages.
  5. Add a JavaScript in the JavaScripts resource folder and copy/paste the below script

if (!window.AlphaPagination) { 
	function AlphaPagination() {
		this.name = "AlphaPagination";
		this.postPagination = function postPagination(mergeType) {
			if ($("HTML").hasClass("DESIGN")) {
				var pagecountstring = $(this).text();
				pagecountstring = pagecountstring.replace('{#}', String.fromCharCode(index+65));
	window.scriptextensionpoint.register(new AlphaPagination());

Hello Rod,

This looks perfect.

I’ve been playing around with the script today but I seem to have an issue with the preview not updating or refreshing. Changes are only seen if I close and re-open the template. Any ideas?

Many thanks,


The pagination script is loaded when the template is opened.
The script itself isn’t executed, but the loaded version of the script is executed. That’s why you need to reload the template when a pagination script is changed.

The output is correct. Thank you so much.

Do you mind providing some guidance on the following post:


Many thanks in advance,



Can you elaborate a bit why you would not be able to add page numbers in the output preset?

In the ‘add text’ you could do something like:

${LETTERS=“ABCDEFGHIJKLMNOPQRSTUVWXYZ”;LETTERS.charAt((document.sequence.job-1) % 26)+LETTERS.charAt((page.nr-1) % 26)}?

@johndoe Im interested in how you got this to work, I get an error. I am trying to create a BCS character inserter control barcode and need to convert numbers to Alpha…

Just added it to the add text in the output preset. What is the error you are getting?

Got it sorted, it was the double quotes, still trying to create this barcode but this has really helped! Thanks.

I need Grouping, Selective Feed, Form Sequence, Form Sequence within job, Form Sequence within Group, Group Sequence, Jog (A,K or U), JobId and MailpeiceID.

This isnt fun!!!

Am I right in thinking I can execute any javascript code within the {$}?

yes, pretty much, I wouldn’t make it a mile long though…

Replying the original request to convert Page Numbers to Alphabet in Connect Designer:
I would use the following technique:

  1. Add an abs box to the Master page and the following text: “Page BNKCONREF X__A__”
  2. Select the A character and choose: Insert > Special Character > Markers > Page Number. The text will look like this: “Page BNKCONREF X__{#}__”
  3. Now right mouse click the section and choose Numbering from the contextual menu. The Numbering dialog appears.
  4. Change the numbering format from 1,2,3,4 to A,B,C,D

Hope this helps,


Erik, this resets the page no when you end the document doesnt it?

I need a page number of the whole job, i.e. I have 100 records in my data which produces 1,024 dynamic pages, I need the page number of each document, but also the page number in the job (1 to 1,024) this is crucial for intelegent enclosing as each sheet of paper in a job needs to be tracked.

I need, Group sequence (i.e. Record no), Page sequence with in the group (i.e. page no in record), last page in group and Page number in job… seems impossible in Connect as far as I can telll even with this new PostPagination script which doesnt seem to return the results as expected…