How to generate PDF`s based on HTML inside flows or extensions using TTA in Directus.

Using PDF generation inside of Directus Flows
Use TTA's PDF operation to integrate PDF generation into Directus Flows. It supports generating a PDF file based on HTML content. You can use any HTML content, including images, tables, and styles.
Operation Settings

Inside of the operation you have the following options:
Option | Description |
---|---|
File name | This is the name of the file that will be generated. |
Options | This is the options that will be passed to the PDF generation library. All options can be found on the API page. |
Output
The output of the operation is a file ID. The file will be placed on the root folder. You can use this ID to update the image with the correct folder/name ect or you can use it in any image field in Directus.
Generating barcodes in your own Directus extension
const fileID = await globalThis.TTA.generatePDF({
'pdfoptions': {
'html': '<h1>Hello {{name}}!</h1>',
'format': 'A4',
'landscape': false,
'margin': 10,
'marginRight': 5,
'marginLeft': 500,
},
'filename': 'file.pdf'
});
Inside of the operation you have the following options:
Option | Type | Description |
---|---|---|
pdfoptions | object | The options that will be passed to the PDF generation library. All options can be found on the API page. |
filename | string | The name of the file that will be generated. |
Output
The output of the operation is a file ID. The file will be placed on the root folder. You can use this ID to update the image with the correct folder/name ect or you can use it in any image field in Directus.