Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 12.0   12.1   12.2   12.3   12.4   12.5   13.0   13.1   13.2   13.3    Statistic    FMM    Blog  


Adds a global JavaScript to the PDF file.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 13.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.AddJavaScript"; PDF; Name; JavaScript )   More


Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf
Name The name for the JavaScript snippet. "test"
JavaScript The JavaScript code.


Returns the handle of the JavaScript or error.


Adds a global JavaScript to the PDF file.
The parameter Name must be a unique name to identify the script in the user interface.
Note that the name is NOT used to identify a function inside the JavaScript. The parameter Script must be a JavaScript function or a set of JavaScript functions. DynaPDF does not check whether the script is valid. A JavaScript is always stored unchecked and unchanged to the PDF file. The JavaScript functions inside a script can be used by JavaScript actions to enable parameterized function calls (see also DynaPDF.CreateJSAction).

See also AddJavaScript function in DynaPDF manual.


Add JavaScript:

Set Variable [ $r ; Value: MBS("DynaPDF.AddJavaScript"; $pdf; "test"; "function test() { return 123; }") ]

See also

Release notes

Blog Entries

This function checks for a paid license.

Created 15th April 2023, last changed 15th April 2023

DynaPDF.AddFontSearchPath - DynaPDF.AddOutputIntent

💬 Ask a question or report a problem

Start Chat