简体   繁体   中英

Nodejs | npm : html-pdf,set image size

I'm using html-pdf to convert an SVG file to PNG, and I can't get the output image size to reflect the input size (128x128). Instead it comes with blank space (see image below). I've tried explicitly setting width and height, setting header and footer height (as per this link<\/a> ), but nothing has any effect.

htmlpdf.create(qrcode, { "border": "0", "type": "png"}).toFile(originalname.split(".")[0]+".png", function(err, res) {
        if (err) throw err;
        console.log(res);
      });

I ended up using npm:sharp .

Worked perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM