I can't tell you how many times I've needed a quick simple html to pdf solution, and instead end up using something a little more complex then the simple requirement deserves. When it comes to building pdf with Rails based solutions, I'm a fan of Prawn. And, I still highly recommend Prawn for serious PDF projects; things like templating and filling in legal forms, where field layout precision and typeset and the driving factors.
But for those times that I already have an html page/form and just want to convert it from html to pdf for download or email has always been either a) too expensive, or b) too complex.
Why can't I use HTML+CSS? Why can't I use a print css media link to drive my HTML to PDF conversion? Why can't it be as seamless as adding some middleware?
Well, now thanks to an open source effort by the folks at Relavance, it looks like we can with: PDFKit
You can read more about it on their blog post.
I can think of so many times this sounds like exactly what the doctor ordered!
I'm not attempting to compare PDFKit and Prawn, because it doesn't look like PDFKis attempting to scratch the same itch that I've come to love Prawn for. But, it does look like PDFKit could potentially be exactly what I've looked for many times over. I'll post more about it once I have another quick HTML to PDF need.
No comments:
Post a Comment