jhayczee09
10/10/2022, 11:12 AMKevin Zwemmer
10/10/2022, 9:37 PMconst renderer = render.create();
renderer.addRecord({ record: invoiceGroup, templateName: 'record' });
const tempId = 'YOUR_TEMPLATE';
htmlLines = htmlLines.replace(/&/gi, '&');
xmlString = xmlString.replace('{{itemsTable}}', htmlLines);
try {
const pdfFile = render.xmlToPdf({ xmlString });
pdfFile.name = `INVOICE_${invGroupNum}.pdf`;
return pdfFile;
} catch(e) {
log.error('error saving pdf', e)
return null;
}
This is a small portion out of our script. ofcourse you need to add data to the HtmlLines with for instance a saved search or just static data.
Then on the template do the following:
<th scope="row">{{Vat}}</th>
<td>{{VAT}}</td>
</tr></table>
{{Headers}} {{itemsTable}}
<table style="width:100%; margin-top: 10px;margin-bottom: 0px; ">
<thead>
</thead>
jhayczee09
10/11/2022, 1:11 AMKevin Zwemmer
10/11/2022, 1:23 AMjhayczee09
10/11/2022, 1:25 AMjhayczee09
10/11/2022, 1:27 AM