This project contains the HTML templates used to generate PDFs that we send to our customers.
/bincontains binaries/buildercontains template builders/contentcontains.jsonand.yamlfiles which describe how to generate the template and what content (text) goes where./generatorcontains a script to generate a template (for a specific/htmlcontains static.htmlfiles that can be used to test the PDF generation and act as blueprints for the templates/pdfscontains the target/sample pdfs that the pdf generation should match/stylecontains the styles in.stylusor plain.csstemplate library) given a content file and a builder/templatescontains the actual templates to be used in a Template service
See this list of engines
We would like to support EJS and doT for now.
Create a content file for the template to be created. This file will describe the basic layout (sections, text, fields etc) and the order of these.
account.json or account.yaml
Select an existing builder or design a new one (in JavaScript).
Run the generator with the builder -b and content file -c to generate one or more template files in specific template engine formats -f.
$ ./bin/template generate child-account -b account-questionaire -c child-account -f dot
<div>Hi {{=it.name}}!</div>
<div>{{=it.age || ''}}</div>Generates template child-account.dot in /templates
Note: See mock-api converter for example on how to write a Node.js executable. You could also use commander
Run the template with a data file and a css file to generate a static html file.
$ ./bin/template run child-account.dot -s basic
Generates child-account.html with basic styling
Validate that the html can be used to generate a satisfactory pdf.
$ ./bin/pdf child-account
The pdf binary should use our pdf service or wkhtmltopdf installed locally (f.ex via Docker)