Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

batch file page number sequence

Explorer ,
Dec 12, 2018 Dec 12, 2018

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

TOPICS
Acrobat SDK and JavaScript
706
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Dec 13, 2018 Dec 13, 2018

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

...
Translate
LEGEND ,
Dec 12, 2018 Dec 12, 2018

Probably by changing the script. How do you combine?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2018 Dec 13, 2018

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 });

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 13, 2018 Dec 13, 2018

Ok... that will combine the files. How do you add the page numbers at the moment?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2018 Dec 13, 2018

I don't.  That is were I need help.  The below code doesn't work

this.setPageLabels(0, [ "D", "", 1]) or openDoc.setpageLabels().

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 13, 2018 Dec 13, 2018

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2018 Dec 13, 2018
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines