devongovett/pdfkit — pull request #223 by devongovett (2014-04-14 05:54:06+00:00)
Title: Support using PDFKit in the Browser, thanks to Browserify!

Awesome announcement: PDFKit v0.6 now supports being used in the browser, thanks to Browserify! You can read the documentation in the [readme](https://github.com/devongovett/pdfkit/blob/9b3d80417020c4778737c854f62763fecb762b3e/README.md#browser-usage), on the website, and in the PDF guide.

Basically, I did a bunch of work to make PDFKit friendly to browserify, wrote a new [zlib module](https://github.com/devongovett/browserify-zlib) for browserify that is compatibile with Node's API, and wrote a module called [blob-stream](https://github.com/devongovett/blob-stream) to take the output of any stream and turn it into an HTML5 Blob object that you can use to view the PDF in the browser directly, trigger a download, or upload to a server.

I also added the ability to use Buffers as a source to the `font` method, just as you can for images. This is especially useful in the browser where you don't have access to a file system. You can load your fonts or images from an HTTP request, or even inline them into your browserify bundle using [brfs](https://www.npmjs.org/package/brfs), and then pass them to PDFKit to get around the lack of a file system in the browser.

I will be uploading precompiled versions of PDFKit to Github's releases section from now on, so you can use those if you don't want to use Browserify.

You can see an interactive demo of PDFKit running in the browser [here](http://pdfkit.org/demo/browser.html).