Copy link to clipboard
Copied
Hi,
I can't find the [JS] syntax to number the pages of a document: 001, 002, 003, …! Annoying!
Thanks for your help!
(^/)
Copy link to clipboard
Copied
I did it like this:
var myNumbering = allPages
.name; myNewNumbering = ("00" + myNumbering).slice(-3);
What I really wanted was , having n pages, export them to eps and have a numbering with 3 numbers!
So, 1 ==> 001, 2 ==> 002, … 58 ==> 058, … 112 ==> 112!
(^/)
Copy link to clipboard
Copied
Hi,
It is under sectionPrefix.. we need to give "00" until 99.. use for loop..
aDoc = app.activeDocument;
aDoc.sections.everyItem().sectionPrefix = "0";
aDoc.sections.everyItem().includeSectionPrefix = true;
useful thread
Copy link to clipboard
Copied
try this:
var main = function () {
var d = app.properties.activeDocument,
ps, p, n, epsFile, pn;
var zeros = "000";
if ( !d ) return;
ps = d.pages;
n = ps.length;
while (n--) {
p = ps
; pn = p.name;
epsFile= File ( Folder.desktop+"/"+zeros.slice(0, -pn.length )+pn +".eps" );
app.epsExportPreferences.pageRange = pn;
d.exportFile ( ExportFormat.EPS_TYPE, epsFile );
}
}
main();
HTH
Loic
Copy link to clipboard
Copied
InDesign ExtendScript API (10.0)
Section.pageNumberStyle=PageNumberStyle.DOUBLE_LEADING_ZEROS