GenerateDocument(file, template) Last updated: 31. Mar 2023

API only function

Produces a file using the specified template (HTML, PDF etc) and returns it as a byte array.

Parameters

Name Type Description
file string Absolute path to file.
template string Name of the template to use to generate this file's output.

Returns

Returns a byte array if successful otherwise an error message.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
// Generate a PDF and store it in a variable
let data = docly.generateDocument(
    "somefile", 
    "Contract.html.pdf");