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

batch file page number sequence

Explorer ,
Dec 12, 2018 Dec 12, 2018

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

TOPICS
Acrobat SDK and JavaScript

Views

416

Translate

Translate

Report

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

...

Votes

Translate

Translate
LEGEND ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

Probably by changing the script. How do you combine?

Votes

Translate

Translate

Report

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

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().

Votes

Translate

Translate

Report

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

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?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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