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!
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.
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.
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.
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.
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
})
Copy link to clipboard
Copied
Are there any other form fields or markup annotations in these documents?
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.
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.
Copy link to clipboard
Copied
Thank you!!!