Executing embedded JavaScript in PDF on iOS


I have following query regarding the functionality in PDFNet SDK for iOS .

A PDF file has some JavaScript code in it (custom calculation script). I observed that the sample app available with the SDK doesn’t interpret it.

I would like to know whether the SDK supports JavaScript (custom calculation script). If yes, could you please provide a sample/ some help regarding the API to use?

A: PDFNet does not perform JavaScript form calculations for security reasons, however it is possible to implement this functionality on your end because PDFNet provides access to the JavaScript associated with the form. How to extract the JavaScript string is outlined in this post on our online support forum: https://groups.google.com/d/topic/pdfnet-sdk/T1VHyqBOaoU/discussion

iOS has the ability to interpret JavaScript strings (UIWebView’s stringByEvaluatingJavaScriptFromString:), so you could extract the proper data from the PDF, have iOS perform the calculation, and then put the result back into the PDF at the appropriate spot.