- From the backoffice template edition interface as:
- Code that is stored together with the template settings
- As a link to an external .js file
- As an option parameter passed within the URL query
In the following we elaborate on these options.
By clicking on the > button located in the top menu:
As you can see from the above screenshot it is possible to instruct the Docxpresso end user interface to load:
- The code directly inserted in the “Custom JS” text box provided in the interface. In this case we have just included a simple alert to illustrate the functionality.
This method allows for maximum flexibility because it allows to further customize the code for predefined users.
The simplest possible to load dynamically these JS files is by the use of the Docxpresso SDK by first defining a data array:
$data = array("template" => 46, "responseExternalJS" => "https://www.mydomain.com/js/external.js")
(where the template id has been set to 46 as an example) and calling the SDK previewDocument method with $data as only parameter: previewDocument($data).