首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >恢复损坏pdf表格内容的脚本

问恢复损坏pdf表格内容的脚本
EN

Stack Overflow用户
提问于 2017-04-18 01:33:51
回答 1查看 204关注 0票数 1

这是我的第一个问题,所以请善待我。

最近,我们在可填充PDF表单方面遇到了问题。从本质上说,如果数据被输入,然后保存在Macintosh上,数据就会完全消失(您可以在这里读到更多关于这个:https://forums.adobe.com/message/3951187)。

我准备了下面的脚本来自动化这个过程(这要感谢JoelGeraci。您可以查看他的GitHub页面以获得更多信息@ https://gist.github.com/JoelGeraci/05e15f3792b299b68be900ab4489e959),但当我在adobe中运行时,它并不会循环到每个字段。关于我怎么解决这个有什么建议吗?

代码:

代码语言:javascript
复制
/*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
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-04-18 08:51:07

因此,您还注意到,对于PDF表单来说,Preview.app是绝对有害的。不幸的是,伤害不仅仅是不创造表象,而且任何形式中的逻辑都会被破坏。

因此,将表单数据导出为FDF更安全,并将其导入表单的空白版本。导出/导入应在Reader XI及更新版本中提供。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43462147

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档