Skip to content

Instantly share code, notes, and snippets.

@pablonarvaez20152016
Last active October 6, 2020 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablonarvaez20152016/3a0731b26d4f08beb96486d060f0f716 to your computer and use it in GitHub Desktop.
Save pablonarvaez20152016/3a0731b26d4f08beb96486d060f0f716 to your computer and use it in GitHub Desktop.
var getPDF = async (template, data, helpers = '', header = '', footer = '') => {
try {
return client.render({
template: {
content: template,
recipe: 'phantom-pdf',
engine: 'handlebars',
helpers: helpers,
phantom: {
header: header,
footer: footer,
format: 'Letter',
orientation: 'portrait',
headerHeight: "2.5 cm",
footerHeight: "1 cm",
margin: {
"top": "1 cm",
"left": "0.5 cm",
"right": "0.5 cm",
"bottom": "1 cm"
},timeout: 9480000
}
},
data: data,
options: {
reports: {
"save": true
}
},
});
} catch (error) {return error;}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment