javascript - PDF Acro javascript 对话框问题

标签 javascript pdf dialog acrobat

我正在创建自定义 PDF 对话框,但在获取输入的值时遇到问题。我检查了代码,找不到问题所在。当我按接受并显示输入到 field1 中的值时,它显示“未定义”。任何有关错误所在的指示都会有所帮助,提前致谢。

 [// Dialog Definition]
var oDlg = {
 field1: "",
 field2: "",
 field3: "",
 field4: "",
// [* initialize: Method that runs when the dialog is created*]
 initialize: function(dialog) {
 var dlgInit = {
 "firstLine":this.field1,
 "secondLine":this.field2,
 "thirdLine":this.field3,
 "forthLine":this.field4,};
 dialog.load(dlgInit);
 },
// [* commit: Method called when OK button is selected*]
 commit: function(dialog) {
  var data = dialog.store();
  this.field1 = data["firstLine"];
  this.field2 = data["secondLine"];
  this.field3 = data["thirdLine"];
  this.field4 = data["forthLine"];
 },
// [* description: Actual dialog box fields *]
 description: {
  name: "Test Dialog",
  elements: [ {
   type: "view",
   elements: [ {
    name: "Additional Information",
    type: "static_text",
   },
   {
    name: "(For Further Credit, Reference of other Information)",
    type: "static_text",
   },
   {
    item_id: "firstLine",
    type: "edit_text",
    char_width: 35
   },
   {
    item_id: "secondLine",
    type: "edit_text",
    char_width: 35
   },
   {
    item_id: "thirdLine",
    type: "edit_text",
    char_width: 35
   },
   {
    item_id: "forthLine",
    type: "edit_text",
    char_width: 35
   },

   {
    type: "ok_cancel",
   },
  ] },
 ] }
};

[// Dialog Activation]
if( "ok" == app.execDialog(oDlg)) { // [* ok_cancel button was pressed with ok *]
app.alert("The value is: "+oDlg.field1,3);
}

最佳答案

http://www.aiim.org/documents/standards/pdf/AcroJS.pdf

第 99 页 - item_id 描述:

"An ItemID for this dialog, which is a unique 4- character string."

你的问题现在有点老了,但也许我的回答可以帮助其他人。 ;)

关于javascript - PDF Acro javascript 对话框问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22106330/

相关文章:

javascript - 如何记录按键事件的时间?

PDF 间接引用和增量更新

pdf - PDF 文件的视觉差异以确定像素完美度

windows - 有没有办法从 Windows 批处理文件启动对话框?

javascript - 链接在 js-mindmap 上不起作用

javascript - 数据为空或零时如何继续行?

javascript - 在我的案例中使用带有变量的 jquery 选择器失败

python - 将文档转换为 pdf 格式的有效方法

gwt 面板水平对齐不起作用

user-interface - WIX 相当于 C# 文本框?