Skip to content

Instantly share code, notes, and snippets.

@JoelGeraci
Created December 4, 2016 20:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoelGeraci/05e15f3792b299b68be900ab4489e959 to your computer and use it in GitHub Desktop.
Save JoelGeraci/05e15f3792b299b68be900ab4489e959 to your computer and use it in GitHub Desktop.
Adds a menu item to repair form field appearances in Adobe Acrobat and Reader
/*
Version 1.4 (Updated for Acrobat DC)
Folder Level Javascript Created by Joel Geraci - joel@practicalpdf.com
*/
if (app.viewerType != "Reader" || app.viewerVersion >= 11) {
app.addMenuItem({
cName: "PPDF_fixFields",
cUser: 'Fix Field Appearances',
cParent: 'Edit',
cExec: "fixFields()",
cEnable: "event.rc = (this.numFields > 0);"
});
function fixFields() {
nFields = this.numFields;
var t = app.thermometer;
t.duration = nFields;
t.begin();
for (var i = 0; i < nFields; i++) {
var f = this.getField(this.getNthFieldName(i));
f.delay = true;
f.delay = false
t.value = i;
}
t.end();
if (app.viewerType != "Reader") {
this.info.Producer = "Adobe Acrobat " + app.viewerVersion
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment