Hi,
I'm totally new to Javascript so this might be an easy question.
I have a script that inserts a text field with a barcode in the upper right corner of the first page on every pdf-file. If I run the script multiple times it just add a new text field on top of the existing one. I want the script to remove any existing fields and insert a new one leaving the file with only one (the last inserted) text field. Can anyone please tell me how to do this?
Here's my script:
/* Insert Barcode */
var aPage = this.getPageBox();
aPage[3] = aPage[1] - 50;
aPage[0] = aPage[2] - 1000;
var f = this.addField("myText", "text", 0, aPage);
var FN = documentFileName;
f.delay = true;
f.readonly = true;
f.alignment = "right";
// f.textFont = "Arial";// a barcode font is required here
f.textFont = "Code39-WideTT-Regular";// a barcode font is required here
f.textSize = 60;
f.fillColor = color.transparent;
f.value = "*" + FN.substring(0,FN.length-4) + "*";
f.delay = false;
Regards
ThomasJ
this.removeField("myText");
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com