nodepdf

NodePDF (GitHub: TJkrusinski/NodePDF, License: MIT) is a module by TJ Krusinski for creating PDF files from web pages. It depends on PhantomJS and works by simply taking a screenshot of a page and stuffing it into a PDF. One the plus side, this makes it really easy to do mostly graphics based PDF files from node. On the down side, the content isn’t scalable at all, so printing quality will suffer.

npm install nodepdf

Usage

var nodepdf = require('nodepdf');

// last argument is optional, sets the width and height
// for the viewport to render the pdf from
var pdf = new nodepdf(
  'http://npmawesome.com',
  'npmawesome.pdf',
  {
    args: '--debug=true',
    viewportSize: {
      width: 500,
      height: 300
    }
  }
);

pdf.on('error', function(msg){
    console.log(msg);
});

pdf.on('done', function(pathToFile){
    console.log(pathToFile);
});

I can imagine this being used for something simple, like printing tickets, post cards, photos and so on.