0

My code

var options = {format:'A3',border:{top:'30px',bottom:'30px',left:'10px'}}
                pdf.create(html,options).toBuffer(function(err, buffer){
                    res.type('application/pdf');
                    res.end(buffer, 'binary');
                });

This is always renders the page with a constant height. How to set the page height ? Thanks !

Vivek Iyer
  • 154
  • 1
  • 6
  • 16

1 Answers1

4

You have to give Header and footer "height" in the options . This will something like:

var options = {format:'A3',header: {  "height": "5mm"},footer: { "height": "5mm"}, border:{top:'30px',bottom:'30px',left:'10px'}}
                pdf.create(html,options).toBuffer(function(err, buffer){
                    res.type('application/pdf');
                    res.end(buffer, 'binary');
                });
Abhinav bhardwaj
  • 2,657
  • 25
  • 21
  • How will that help setting the height of the whole page ? I want to set the height of the page (header, body, footer) This does not solve my problem. – Vivek Iyer May 07 '18 at 10:07
  • 1
    You can use page options like "height": "10.5in", // allowed units: mm, cm, in, px "width": "8in", from https://www.npmjs.com/package/html-pdf#options – Abhinav bhardwaj May 08 '18 at 07:52