Last active
October 6, 2020 17:25
-
-
Save pablonarvaez20152016/3a0731b26d4f08beb96486d060f0f716 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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