Copy link to clipboard
Copied
Hi there!
I'm having problem using javascript to make read-only a fillable pdf.
I always used this script:
var r = app.alert("Sei sicuro di voler bloccare il PDF?",2,2);
if (r == 4) { // 4 is Yes, 3 is No
for (var i = 0; i < this.numFields; i++) {
var fname = this.getNthFieldName(i);
this.getField(fname).readonly = true; // makes all fields readonly }
}
but ultimately it won't work, sometimes all form fields remain editable, sometimes some are ready-only and some are not.
Since I'm not a java expert, is there any way to make it work again?
Thanks!
Copy link to clipboard
Copied
See if this will work:
var r = app.alert("Sei sicuro di voler bloccare il PDF?",2,2);
if (r == 4) {
for (var i=0; i<this.numFields; i++) {
var f = this.getField(this.getNthFieldName(i));
if (f==null) continue;
f.readonly = true;
}}
Copy link to clipboard
Copied
Find more inspiration, events, and resources on the new Adobe Community
Explore Now