brenden / node-webshot

Easy website screenshots in Node.js
2.12k stars 285 forks source link

Vector PDF / generate without rasterization? #117

Closed abecks closed 7 years ago

abecks commented 9 years ago

I'm generating PDFs of a webpage that are coming out at 1.5mb. The text is not selectable, it's just one big image.

Is it possible to generate a vector PDF? Much like "Save as PDF" in Chrome or Safari would generate?

I'm using the following:

webshot(url, path, {
    phantomPath: '/usr/local/bin/phantomjs',
    renderDelay: 100,
    paperSize: {
      width: '612px',
      height: '792px',
      orientation: 'portrait',
      border: '1cm'
    },
    customCSS: '.adminLayout{ zoom:0.6;}',
    settings: {
      localToRemoteUrlAccessEnabled: true,
      webSecurityEnabled: false,
    }
  }, function(err) {
    callback && callback(err, path);
  });

Edit: this may be related to: https://github.com/ariya/phantomjs/issues/10373