I am trying to execute inserted javascript block on document open. The following is a code snippet:
document.JavaScripts.Add(new DocumentJavaScript("CalcAndSubmitOnOpen",
" this.setPageAction(0, \"Open\", \"var fobj = this.getField(\\\"SYS_FORM_ACTION\\\"); if(fobj != null) { if(fobj.value != \\\"\\\") {var act = fobj.value; this.calculateNow(); submitForm( {cURL: act, bEmpty: true, bXML: true, cSubmitAs: \\\"PDF\\\" }); } else { app.alert('Form submit handler is not configured!'); } } \");"));
This executes in some environments, but not in others. For example, IE11 will correctly execute this block on one box but not on another. This could be due to versions of the adobe products being installed? How can I ensure execution on document open? Thanks.
javascript on document open
Re: javascript on document open
Support · Oct 31, 2016Hello,
After reviewing the information emailed to us, it has been determined that the issue is not caused by DynamicPDF, but rather caused due to the usage of Adobe Java Script function setPageAction. This function is not supported in Adobe Reader but works in Adobe Acrobat Professional. In the code listed in previous post, DynamicPDF is adding the java script to the PDF accurately as per the PDF specification. Please avoid using setPageAction if your java script code has to run in Adobe Reader.
Thanks,
ceTe Software Support Team.