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

Is there a way to add consecutive page numbers and exhibits?

New Here ,
Jun 12, 2024 Jun 12, 2024

Copy link to clipboard

Copied

I am looking to add a footer to a batch of documents. The documents would be labeled in order as Exhibit 1, Exhibit 2, etc. but the page numbers would be continuous. 

 

Ex. Document 1 would have a footer that is labeled "Exhibit 1 - Page 1; Exhibit 1 - Page 2" and then the next document would be labeled "Exhibit 2 - Page 3; Exhibit 2 - Page 4" and so on. 

 

I am fairly familiar with action wizard but I don't know how to write the code for this action. 

 

Thanks!

TOPICS
Edit and convert PDFs , How to , JavaScript , PDF

Views

1.4K

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
2 ACCEPTED SOLUTIONS
Community Expert ,
Jun 12, 2024 Jun 12, 2024

Copy link to clipboard

Copied

Use the Action Wizard to execute a javascript that creates a field at the bottom of the page.  Set the field's value to "Exhibit (variable 1) - Page (variable 2)", on every page, then flatten the fields.  You will have to create two global variables for the numbering.  The Exhibit number variable will start at 1 and advance by 1 for every document.  The Page number variable will advance by 1 for each page and not reset.

View solution in original post

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
Community Expert ,
Jun 12, 2024 Jun 12, 2024

Copy link to clipboard

Copied

Here's the script:

if(global.ExhibNum==undefined)
{global.ExhibNum=1}
if(global.PageNmbr==undefined)
{global.PageNmbr=1}

for(var i=0;i<this.numPages;i++)
{
var cb=this.getPageBox("Crop",i)[2];
var f=this.addField("Numbering."+i,"text", i,[0, 72*.5, cb, 72*.25]);
f.alignment="center";
f.value="Exhibit "+ global.ExhibNum + " - Page " + global.PageNmbr;
global.PageNmbr=Number(global.PageNmbr)+1;
}

global.ExhibNum=Number(global.ExhibNum)+1;
this.flattenPages();

Notes:

1)  The bottom of the field is 1/4 inch from the bottom of the page (72*.25).  The top of the field is 1/2 inch from the bottom of the page (72*.5).  Adjust acccordingly.

2)  The line this.flattenPages(); flattens all fields and annotations.  If you only want to flatten the fields created you will have to write another script to do this.

3)  Make sure you run the following script in the console after each run so the global variables do not continue for the next run:

delete global.PageNmbr;
delete global.ExhibNum;

 If you want to automatically delete these global variables after the run, this article explains how.

View solution in original post

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
New Here ,
Jun 12, 2024 Jun 12, 2024

Copy link to clipboard

Copied

Even better would be if I could shrink the document like you can when bates labeling so the footer doesn't overlap any pre-existing text. 

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
Community Expert ,
Jun 12, 2024 Jun 12, 2024

Copy link to clipboard

Copied

Use the Action Wizard to execute a javascript that creates a field at the bottom of the page.  Set the field's value to "Exhibit (variable 1) - Page (variable 2)", on every page, then flatten the fields.  You will have to create two global variables for the numbering.  The Exhibit number variable will start at 1 and advance by 1 for every document.  The Page number variable will advance by 1 for each page and not reset.

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
New Here ,
Jun 12, 2024 Jun 12, 2024

Copy link to clipboard

Copied

How would the code be written for that? I saw another user (Try67) said to use this code for a something somewhat similar. Not the same but I (with my limited coding knowledge) feel like it could be tweaked to use for the "Exhibit (variable 1) - Page (variable 2) model that I need? 

 

 

this.addWatermarkFromText({

    cText: this.documentFileName.substring(0,3), cFont: "Arial,Bold", nFontSize: 14, aColor: color.red,

    nHorizAlign: app.constants.align.right, nVertAlign: app.constants.align.top, nHorizValue: -36, nVertValue: -36

})

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
Community Expert ,
Jun 12, 2024 Jun 12, 2024

Copy link to clipboard

Copied

Are there any other form fields or markup annotations in these documents?

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
New Here ,
Jun 12, 2024 Jun 12, 2024

Copy link to clipboard

Copied

Depends but typically they will already be bates labeled and may also have an exhibit stamp. This stamp would be an actual exhibit sticker v. the exhibit text I am looking to add. The exhibit numbers will not match up. 

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
Community Expert ,
Jun 12, 2024 Jun 12, 2024

Copy link to clipboard

Copied

Here's the script:

if(global.ExhibNum==undefined)
{global.ExhibNum=1}
if(global.PageNmbr==undefined)
{global.PageNmbr=1}

for(var i=0;i<this.numPages;i++)
{
var cb=this.getPageBox("Crop",i)[2];
var f=this.addField("Numbering."+i,"text", i,[0, 72*.5, cb, 72*.25]);
f.alignment="center";
f.value="Exhibit "+ global.ExhibNum + " - Page " + global.PageNmbr;
global.PageNmbr=Number(global.PageNmbr)+1;
}

global.ExhibNum=Number(global.ExhibNum)+1;
this.flattenPages();

Notes:

1)  The bottom of the field is 1/4 inch from the bottom of the page (72*.25).  The top of the field is 1/2 inch from the bottom of the page (72*.5).  Adjust acccordingly.

2)  The line this.flattenPages(); flattens all fields and annotations.  If you only want to flatten the fields created you will have to write another script to do this.

3)  Make sure you run the following script in the console after each run so the global variables do not continue for the next run:

delete global.PageNmbr;
delete global.ExhibNum;

 If you want to automatically delete these global variables after the run, this article explains how.

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
New Here ,
Jun 12, 2024 Jun 12, 2024

Copy link to clipboard

Copied

LATEST

Thank you!!!

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