Copy link to clipboard
Copied
I have a batch script which combines all files in a folder. I can add an Page processing action to add page numbers but it only pages each document separately.
Is there a way I can do page numbers as a sequence of my entire documents.
Example:
1 Doc = 2 pages
2 Doc = 3 pages
Final doc should be stamped with pages 1-5
1 Correct answer
Found IT!!!! the below code will set the page number as a footer and place in center.
************************************************************************************
var Box2Width = 50;
for (var p = 0; p < openDoc.numPages; p++) {
var aRect = openDoc.getPageBox("Crop",p);
var TotWidth = aRect[2] - aRect[0];
var bStart=(TotWidth/2)-(Box2Width/2);
var bEnd=((TotWidth/2)+(Box2Width/2));
var fp = openDoc.addField(String("xftPage"+p+1), "text", p, [bStart
...Copy link to clipboard
Copied
Probably by changing the script. How do you combine?
Copy link to clipboard
Copied
var openDoc = app.openDoc({cPath: myPath}); < --Doc1 and the one I am adding Doc2 to.
// Get path of the file Acrobat has taken from the selected files
var path2file = this.path; <--Doc2
openDoc.insertPages ({ nPage: lastpage - 1, cPath: path2file });
Copy link to clipboard
Copied
Ok... that will combine the files. How do you add the page numbers at the moment?
Copy link to clipboard
Copied
I don't. That is were I need help. The below code doesn't work
this.setPageLabels(0, [ "D", "", 1]) or openDoc.setpageLabels().
Copy link to clipboard
Copied
setPageLabels sets page labels which you see in the "page number" display at the top of Acrobat. It allows you for instance to have page i, ii, iii, 1-1, 1-2 and so on. It doesn't add text to page contents.
I think the main way to add page numbers to each page is a unique for field on each page, but I have a feeling there is a better way. Anyone?
Copy link to clipboard
Copied
Found IT!!!! the below code will set the page number as a footer and place in center.
************************************************************************************
var Box2Width = 50;
for (var p = 0; p < openDoc.numPages; p++) {
var aRect = openDoc.getPageBox("Crop",p);
var TotWidth = aRect[2] - aRect[0];
var bStart=(TotWidth/2)-(Box2Width/2);
var bEnd=((TotWidth/2)+(Box2Width/2));
var fp = openDoc.addField(String("xftPage"+p+1), "text", p, [bStart,30,bEnd,15]);
fp.value = "String(p+1);
fp.textSize = 6;
fp.readonly = true;
fp.alignment="center";
}
*********************************************************************************************
Full Example = Adobe Acrobat 9 Javascript to add footer to document - Stack Overflow

