[英]PDF JavaScript does not work in Adobe Reader DC but all other Readers
[英]PDF Javascript for Custom Stamp not working in Adobe Reader DC
以下代码用于Adobe Reader中的自定义图章。 此代码用于邮票表中3个文本字段的行。
它的作用:放置图章时,在javascript窗口中要求用户输入。 提交后,自定义图章表格中的文本字段将填充输入。
问题:它在Adobe Acrobat Pro XI中的所有3个字段均适用。 但是,除了Adobe Reader DC中的第一个字段以外,它都无法工作。 结果其他两个字段为空白。
第一个字段起作用的事实意味着我的代码可以精确到最下面的部分(“ THIS PART HERE!”)。 在修复或让我知道使用用户输入定义字段值的另一种方法方面的任何帮助将不胜感激:)
据我所知( PDF JavaScript在Adobe Reader DC中不起作用,但在所有其他Reader中 ),新的Adobe Reader DC对JavaScript语法非常严格。
var dialog = {
noz8Value: "",
fa8Value: "",
fl8Value: "",
commit:function (dialog) { // called when OK pressed
var results = dialog.store();
this.noz8Value = results["txt1"];
this.fa8Value = results["txt2"];
this.fl8Value = results["txt3"];
},
description:
{
name: "8 Nozzle Load", // Dialog box title
elements:
[
{
type: "view",
elements:
[
{
name: "1st Nozzle ID: ",
type: "static_text",
},
{
item_id: "txt1",
type: "edit_text",
width: 300,
height: 30
},
{
name: "Fa (kN): ",
type: "static_text",
},
{
item_id: "txt2",
type: "edit_text",
width: 300,
height: 30
},
{
name: "Fl (kN): ",
type: "static_text",
},
{
item_id: "txt3",
type: "edit_text",
width: 300,
height: 30
},
]
},
]
}
};
// THIS PART HERE (below)
//Line below Runs dialog function (prompt window) if stamp is placed down
if(event.source.forReal && (event.source.stampName == "#nozzle"))
{
if ("ok" == app.execDialog(dialog))
{
var cMsg = dialog.noz8Value;
event.value = "\n" + cMsg;
event.source.source.info.noz = cMsg;
var cMsg2 = dialog.fa8Value;
this.getField("fa8Field").value = cMsg2;
var cMsg3 = dialog.fl8Value;
var test1 = this.getField("fl8Field");
test1.value= cMsg3
// Above I tried 3 different ways of linking the user input as the field's `value.`
}
}
我修好了它!
没有event.source.source.info.noz = cMsg; 该代码有效。 较旧的版本运行良好,并且比较宽松。 DC很严格。
if(event.source.forReal && (event.source.stampName == "#nozzle"))
{
if ("ok" == app.execDialog(dialog))
{
var cMsg = dialog.noz8Value;
event.value = "\n" + cMsg;
var cMsg2 = dialog.fa8Value;
this.getField("fa8Field").value = cMsg2;
var cMsg3 = dialog.fl8Value;
var test1 = this.getField("fl8Field");
test1.value= cMsg3
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.