Skip to main content
Participating Frequently
May 14, 2019
Answered

Page number with 2 digits

Hello,

I have this code and my goal is get file name with pagenumber, but with two digits ike pdfname 01 pdfname 02... pdfname 09 pdfname 10

Thanks for your help

var nazev = this.documentFileName.replace(/.pdf/,"")

for (var p = 0; p < this.numPages; p++) { this.addWatermarkFromText({ cText: (nazev)+(p + 1 ), nHorizAlign: app.constants.align.center, nVertAlign: app.constants.align.bottom, nHorizValue: 10, nVertValue: 2, nFontSize: 10, nStart: p});

}

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
May 14, 2019

Use this:

cText: (nazev)+util.printf("%02d", (p + 1))

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
May 14, 2019

Use this:

cText: (nazev)+util.printf("%02d", (p + 1))

Translate
zuzukucAuthor
Participating Frequently
May 16, 2019

thanks

Translate