Open Adobe Acrobat Pro
Advanced – Document processing – Batch processing - New
Sequence
Name the sequence *** and click OK
Select the sequence - In Edit Sequence –Select command
- select ->JavaSript – Execute
JavaScript – Add – JavaScript – click edit and paste the javascript there
var re = /.*\/|\.pdf$/ig;
var FileNM =
this.path.replace(re,"")+".pdf";
var Path = this.path;
var Box2Width = 50
for (var p = 0; p < this.numPages; p++)
{
var aRect =
this.getPageBox("Crop",p);
var TotWidth =
aRect[2] - aRect[0]
var fd =
this.addField("xftDate", "text", p, [30,15,
TotWidth-30-30,30]);
fd.value =
FileNM ;
fd.textSize=6;
fd.readonly =
true;
fd.alignment="left" ;
var
bStart=(TotWidth/2)-(Box2Width/2)
var
bEnd=((TotWidth/2)+(Box2Width/2))
var bStart=(TotWidth-Box2Width-30); var
bEnd=(TotWidth-30);
var fp =
this.addField(String("xftPage"+p+1), "text", p,
[bStart,30,bEnd,15]);
fp.value =
"Page: " + String(p+1)+ "/" + this.numPages;
fp.textSize=6;
fp.readonly =
true;
fp.alignment="center";
}
flattenPages();
Get all files that are PDF
Assign the name of the file and append .pdf to it to get
the full filename
Get the path
Assign width of 50 to the box
Loop through all the pages
Get the rectangle and width
Add field field-name, field-type, page-number, location
Set field value
Set field text size
Is it read-only
Alignment in the rectangle
Add another field and follow the same process
Comments
Post a Comment