Hacker News new | past | comments | ask | show | jobs | submit login
PDFKit - A PDF generation library for Node.js. (pdfkit.org)
75 points by jenhsun on Jan 2, 2012 | hide | past | favorite | 10 comments



The source code is a nice read, and quite illuminating, if you've ever wanted to dig under the hood of a PDF:

https://github.com/devongovett/pdfkit/tree/master/lib

edit: In particular, some of this TTF font handling stuff is pretty fun:

https://github.com/devongovett/pdfkit/blob/master/lib/font.c...

You get bonus style points for embedding PostScript in a heredoc.


Thanks Jeremy! You just made my day. :)


I was just coming to comment on my delight in seeing the examples written in CoffeeScript.


Not|soon to be confused with the Ruby gem, PDFKit.

https://github.com/jdpace/PDFKit



Very nice little library: I used it to make a 5-year planner for my mother (who is one of the few who still uses such things: you can't buy them anywhere any more, presumably everyone else plans online now) this year.

Some things seem locked to integer multiples of 1/72th of an inch (so A4 comes out at 8.3x11.7 rather than 8.27x11.69 and laying out lines and text more precisely than that doesn't work) though I didn't delve into it to see if this could be rectified (by using using a smaller unit perhaps) as I didn't need more precision (which I'm guessing most people don't either). Line drawing widths and such take non-integer values fine, just not the line start/end coordinates.

Nice library though, I'll be using it again in future and may even be able to contribute. It may even be my impetus to play with CoffeeScript properly.


I recently switched to using this for a web app from Prawn. The main app is in Ruby, but this was so much nicer (simpler API, much, much faster PDF generation) than Prawn for our particular use case (PDFs with lots of exact positioning of text and images) that I actually set up an entire Node server just to use PDFKit. Give it a shot if you generate a lot of PDFs.


Would be awesome to be able to pass in simple text HTML like: <p>Paragraph <i>here</i>.</p><p>Second paragraph <strong>here</strong>.</p>.


I can vouch for the quality of PDFKit, it is highly pleasant to work with


Looks good and mark it.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: