Step 4 - Provide format and orientation as per your need
"height": "10.5in", // allowed units: mm, cm, in, px
"width": "8in", // allowed units: mm, cm, in, px
"format": "Letter", // allowed units: A3, A4, A5, Legal, Letter, Tabloid
"orientation": "portrait", // portrait or landscape
var options = {
format: "A3",
orientation: "portrait",
border: "10mm",
header: {
height: "45mm",
contents: '<div style="text-align: center;">Footer Text</div>'
},
footer: {
height: "28mm",
contents: {
first: 'Cover page',
2: 'Second page',
default: '<span style="color: #444;">{{page}}</span>/<span>{{pages}}</span>',
last: 'Last Page'
}
}
};
Step 5 - Provide HTML, user data and PDF path for output
var users = [
{
name: "Shyam",
age: "26",
},
{
name: "Navjot",
age: "26",
},
{
name: "Vitthal",
age: "26",
},
];
var document = {
html: html,
data: {
users: users,
},
path: "./output.pdf",
type: "file",
};
Type can be buffer
or stream
or file
(default is file
)