Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

DynaPDF.AddJavaScript

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

Parameters

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

Result

Returns the handle of the JavaScript or error.

Description

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.

Examples

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 license.

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


DynaPDF.AddFontSearchPath - DynaPDF.AddOutputIntent