Answer the question
In order to leave comments, you need to log in
How to remove extra padding above and below for headers and footers when generating pdf with html-pdf in nodejs?
Test script:
var fs = require('fs');
var pdf = require('html-pdf');
var srcFile = 'test.html';
var html = fs.readFileSync(srcFile, 'utf8');
var options = {
"type": "pdf",
"orientation": "portrait",
"format": "A4",
"margin": "0",
"border": {
"top": "0cm",
"right": "0cm",
"bottom": "0cm",
"left": "0cm"
}
};
var data = pdf.create(html, options);
data.toFile('./index.pdf', function(err, res) {
if (err) return console.log(err);
console.log(res);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question