用于恢复损坏的 pdf 表单内容的脚本
Script to restore contents on broken pdf forms
这是我的第一个问题,请多多包涵。
我们最近遇到了可填写的 PDF 表单的问题。如果输入数据然后将其保存在 Macintosh 上,基本上数据似乎会完全消失
(您可以在此处阅读更多相关信息:https://forums.adobe.com/message/3951187)
我准备了以下脚本来自动执行此过程(感谢 JoelGeraci。您可以查看他的 GitHub 页面以获取更多信息@ https://gist.github.com/JoelGeraci/05e15f3792b299b68be900ab4489e959)但它不会循环遍历每个我在 adobe reader DC 中 运行 时的字段。关于如何解决这个问题的任何建议?
代码:
/*Code to fix broken PDF Forms*/
//Check version
if (app.viewerType != "Reader" || app.viewerVersion >= 11) {
app.addMenuItem({
//Add new menu item under the "Edit" tab
cName: "PPDF_fixFields",
cUser: 'Fix Field Appearances',
cParent: 'Edit',
//Run the function "fixFields()"
cExec: "fixFields()",
//Enable this option if the number of fields is greater than 0
cEnable: "event.rc = (this.numFields > 0);"
});
function fixFields() {
//Number of Fields
nFields = this.numFields;
//shows the progress bar
var t = app.thermometer;
t.duration = nFields;
t.begin();
//Cycle through all fields
for (var i = 0; i < nFields; i++) {
//nth Field
var f = this.getField(this.getNthFieldName(i));
//toggle delay to refresh content
f.delay = true;
f.delay = false
//progress bar
t.value = i;
}
//End progress bar
t.end();
//Producer info
if (app.viewerType != "Reader") {
this.info.Producer = "Adobe Acrobat " + app.viewerVersion
}
}
因此,您还注意到 Preview.app 是 PDF 表单的毒药。不幸的是,损害不仅仅是不创建外观,而且表单中的任何逻辑也会被破坏。
因此,将表单数据(实际上仍然存在)导出为FDF,并将其导入到空白版本的表单中会更安全。 Export/Import 应该在 Reader XI 和更新版本中可用。
这是我的第一个问题,请多多包涵。
我们最近遇到了可填写的 PDF 表单的问题。如果输入数据然后将其保存在 Macintosh 上,基本上数据似乎会完全消失 (您可以在此处阅读更多相关信息:https://forums.adobe.com/message/3951187)
我准备了以下脚本来自动执行此过程(感谢 JoelGeraci。您可以查看他的 GitHub 页面以获取更多信息@ https://gist.github.com/JoelGeraci/05e15f3792b299b68be900ab4489e959)但它不会循环遍历每个我在 adobe reader DC 中 运行 时的字段。关于如何解决这个问题的任何建议?
代码:
/*Code to fix broken PDF Forms*/
//Check version
if (app.viewerType != "Reader" || app.viewerVersion >= 11) {
app.addMenuItem({
//Add new menu item under the "Edit" tab
cName: "PPDF_fixFields",
cUser: 'Fix Field Appearances',
cParent: 'Edit',
//Run the function "fixFields()"
cExec: "fixFields()",
//Enable this option if the number of fields is greater than 0
cEnable: "event.rc = (this.numFields > 0);"
});
function fixFields() {
//Number of Fields
nFields = this.numFields;
//shows the progress bar
var t = app.thermometer;
t.duration = nFields;
t.begin();
//Cycle through all fields
for (var i = 0; i < nFields; i++) {
//nth Field
var f = this.getField(this.getNthFieldName(i));
//toggle delay to refresh content
f.delay = true;
f.delay = false
//progress bar
t.value = i;
}
//End progress bar
t.end();
//Producer info
if (app.viewerType != "Reader") {
this.info.Producer = "Adobe Acrobat " + app.viewerVersion
}
}
因此,您还注意到 Preview.app 是 PDF 表单的毒药。不幸的是,损害不仅仅是不创建外观,而且表单中的任何逻辑也会被破坏。
因此,将表单数据(实际上仍然存在)导出为FDF,并将其导入到空白版本的表单中会更安全。 Export/Import 应该在 Reader XI 和更新版本中可用。