简体   繁体   中英

Javascript works in Adobe Reader but not in Nitropdf

I have setup an interactive PDF form with a Javascript button to submit the form by email, extracting data input by the user. The button works fine in Adobe Reader but does nothing in NitroPDF. Is there a problem with the code (see below)?

 var cToAddr = this.getField("ComboBox1").value var cSubLine = "Property Transaction Form " + this.getField("Text1").value var cBody = "The attached file is the filled-out form. Please open it to review the data." this.mailDoc({bUI: true, cTo: cToAddr, cSubject: cSubLine, cMsg: cBody}) 

With the plethora of PDF viewers out there that implement only some of the Acrobat JavaScript API - some more, some less - I recommend testing for the existence of any functions that your document requires before trying to use them. Wrap your code in the snippet below to let the user know that they are using a less capable viewer than what you've programmed the document for.

if (typeof this.mailDoc == 'function') { 
  // The viewer can mail documents 
}
else {
  // Warn the user somehow
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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