Prawn- not just for the BBQ

With the upcoming move, we’ll have to unload & reload our wine collection from the wine cabinet. For some people that may not be a big deal, but when you’re dealing with a few hundred bottles being tracked in a database, it’s important that all the bottles go back to their original location after the move. Hence I’ve been looking at generating a printable inventory that we can take with us for the move. As you may know, printing web pages doesn’t always give the expected results, so I’ve been playing with generating PDF files.

I first looked at PDF::Writer, but OMG- what a complex and confusing API. I just wanted something simple. Just my luck, a new PDF library is in the works called Prawn. Unlike PDF::Writer, Prawn is very simple to learn and use. I was able to generate a pretty respectable multi-page table in less then 30 minutes.

Anyways, the feature is a bit blue collar right now. Since generating PDF’s takes more then a few seconds, I really should have some ajax status thingy and use BackgroundRb for generation, but for a quick hack for our move Prawn made creating this feature quick and easy. Hence, if you’re looking to generate PDF’s in Ruby, I’d highly recommend you try out Prawn even though it’s still in early development.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.