简体   繁体   English

PDF4NET无法以Adobe LiveCycle形式执行JavaScript

[英]PDF4NET not executing the javascript in adobe livecycle form

I have javascript code in few events in an Adobe LiveCycle Form. 我在Adobe LiveCycle Form中的一些事件中都有javascript代码。 When it is loaded with data using PDF4NET, it is not executing the javascript that exists in different events. 使用PDF4NET加载数据时,它不会执行不同事件中存在的javascript。 Here is the sample code. 这是示例代码。 Please help what I need to change in order to make it work. 请帮助我进行更改以使其正常运行。

Sample code in Livecycle form: Livecycle形式的示例代码:

SampleForm::prePrint - (JavaScript, both, Propagation Enabled)

SampleForm.SubForm1.TextField1.rawValue=SampleForm.SubForm1.TextField2.rawValue;

Code in c#: C#中的代码:

         PDFDocument pDFDocument = new PDFDocument(stream);

          ... populate fields  ......

        pDFDocument.get_Form().FlattenFormFields();
        System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
        pDFDocument.Save(memoryStream);
......

Thanks in advance for your help. 在此先感谢您的帮助。

This is mostly guesswork because I don't know PDF4NET but one of these suggestions might work. 这主要是猜测,因为我不了解PDF4NET,但是这些建议之一可能有效。

Having looked at the web site for PDF4NET, it looks like it only has support for static XFA forms. 在查看了PDF4NET网站之后,看起来它仅支持静态XFA表单。 This means that it probably doesn't run the Javascript events. 这意味着它可能不会运行Javascript事件。 You can verify this by populating a field on the init event (of either the field or the form) and seeing if it works. 您可以通过在init事件(字段或表单)上填充一个字段并查看其是否有效来验证这一点。

If the script events are running, depending on the Javascript interpreter and the XFA object model, your script might be wrong. 如果脚本事件正在运行,则取决于Javascript解释器和XFA对象模型,您的脚本可能是错误的。 It might not be able to resolve SampleForm from a script on SampleForm . 它可能无法从SampleForm的脚本解析SampleForm Try putting the script on SubForm1 and changing it like this: 尝试将脚本on SubForm1并进行如下更改:

TextField1.rawValue = TextField2.rawValue;

If that fails you could try using resolveNode() to get the fields. 如果失败,则可以尝试使用resolveNode()获取字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM