PDF templates and documents

PDF tools manage the templates of the PDF Designer and work with the PDF documents generated from them.

The tools do not change the design of a template, that is, its document tree. save_pdf_template only changes the general settings of a template. Design the template itself in the PDF Designer.

A document is always generated from the activated version of a template. After you change a template, call activate_pdf_template to make the saved version available for generation. A new template is created with the status Inactive, so it cannot be used for generation until you activate it.

Required role: pdf_template.

If your user account does not have this role, the template tools fail immediately with an access denied error. Contact an administrator to request the role, or see Access control for more information on how roles are enforced.

To change, activate, or delete a template that belongs to a development package with roles, you need a role with edit access to that package. Administrators can always edit. You cannot assign a template to a template package. To move a template to another package, you also need access to the target package.

list_pdf_templates only returns templates from development packages that you can access.

generate_pdf_document and get_pdf_document check the runtime access to the PDF template instead, as set in the access and roles of the template. You can generate or read a document only if you have runtime access to its template.

Available tools

Parameters are shown with their type and a short description. UUIDs are always strings.

PDF templates

Tool Description Parameters

list_pdf_templates

List PDF templates.

listOptions (object, optional). Fields: application, description, changedBy, updatedAt, package, ver, connector.

get_pdf_template

Return a PDF template by its ID.

id (string): ID of the PDF template.

save_pdf_template

Create or update the general settings of a PDF template: description, package, connector, access, and roles. Omit id to create a new template. The design of the template does not change.

A new template gets an empty design with the Settings, Content, and Styles document components, an empty interface, and the status Inactive. Public access and storage of generated documents are turned off.

id (string, optional): ID of the template. Omit to create a new template.

application (string): Name of the template. Required for a new template.

description (string, optional): Description of the template.

package (string, optional): ID of the development package.

connector (string, optional): ID of the connector used as the interface, with enableConnector (boolean).

publicAccess (boolean, optional): Allows generation without authentication.

disabled (boolean, optional): Disables the template.

enableStorage (boolean, optional): Stores generated documents so they can be retrieved later.

roles (array, optional): Roles that grant runtime access to the template.

activate_pdf_template

Activate a PDF template, which makes its saved design available for generation. The activation fails if another user holds the edit lock of the template.

id (string): ID of the PDF template.

delete_pdf_template

Delete a PDF template by its ID, including its activated version and all stored documents generated from it.

id (string): ID of the PDF template.

Deleting a template also deletes every stored PDF document that was generated from it. The documents cannot be retrieved afterwards.

PDF documents

Tool Description Parameters

generate_pdf_document

Generate a PDF document from an activated template and bind the data that you pass into it. To store the document so you can retrieve it later with get_pdf_document, pass an objectKey. The response contains the PDF with the URI pdf://<template>/<objectKey>. The generation fails if the template does not exist or is disabled.

pdf (string): Name of the PDF template.

data (object, optional): The data bound into the template interface.

objectKey (string, optional): Key under which the generated document is stored.

securityKey (string, optional): Key stored with the document. To retrieve the document later, pass the same key to get_pdf_document.

language (string, optional): Language of the generated document.

list_pdf_documents

List stored PDF documents that were generated within a date range. You can filter by template name. The response contains pdfs and numRecords, the total number of matching documents. Each document contains id, application (the template name), objectKey, securityKey, and createdAt. Use objectKey and securityKey to retrieve the document with get_pdf_document.

applications (string[], optional): Names of the PDF templates to filter by.

dateStart (string): Start of the date range, for the creation time of the documents.

dateEnd (string): End of the date range.

pagination (object): take for the number of documents, skip for the number to skip, and order for the sort order.

get_pdf_document

Return a stored PDF document by template and objectKey, as generated by generate_pdf_document.

pdf (string): Name or ID of the PDF template.

objectKey (string): Key of the stored document.

securityKey (string, optional): Security key of the stored document when saving in the PDF Archive tool is enabled.