title: output pdf using stream
body: <p>How do I output the pdf using expressjs:</p>
  
  <pre><code>var fs = require('fs');
  var PdfPrinter = require('pdfmake/src/printer');
  
  app.get('/', function (req, res) {
      var printer = new PdfPrinter();
  
      var first = 'Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines';
  
      var dd = {
          content: [
              first,
              'Another paragraph'
          ]
      };
      var pdfDoc = printer.createPdfKitDocument(dd);
      pdfDoc.pipe(fs.createWriteStream('basics.pdf')).on('finish',function(){
          //success
  
      });
      pdfDoc.end();
  });
  </code></pre>