Docx Template with handlebars to PDF
-
Hi, new user here.
We've started using JSReport as a docx-template filler in our system with handlebars, but sometimes we would like the output of this template to be a PDF.
What's the convention and best practice here?jsreport.render({ template: { engine: 'handlebars', recipe: 'docx', helpers: this.helpers, docx: { templateAsset: { content: content.toString('base64'), encoding: 'base64', }, }, }, data: formattedData, });
-
You have two options.
Use unoconv extension which allows to convert docx to pdf
https://jsreport.net/learn/unoconvWrite two separate templates for docx and pdf. One using handlebars in docx template and second using html and chrome convert.
-
Thanks!
(For some reason, I hoped it will be easy as flipping the recipe switch)