Prawn x Wicked PDF x PDFkit

171 views
Skip to first unread message

Elton Santos

unread,
Feb 22, 2016, 4:25:50 PM2/22/16
to Prawn
Hi guys, I never use no one and I have this doubt. Which of three is more .easy and powerfull?
Most who know say that is the Prawn, but do not explain why. Which has more tutorials?
Thanks!

Alexander Mankuta

unread,
Feb 22, 2016, 4:41:52 PM2/22/16
to Prawn
Hi Elton,

Of course we will tell you that Prawn is better. ;)

But all jokes aside Prawn is a bit different to both Wicked PDF and PDFKit. Both PDFKit and Wicked PDF are built on top of wkhtmltopdf. That is a special WebKit implementation that does rendering to PDF. So both of those gems are rendering HTML/CSS to PDF. It may suit your needs but you have to consider that they both depend on external rather large binary and since WebKit doesn't support CSS Paged media spec 100% it may lack some feature you'd expect in a full implementation. Also PDF is not natively supported by WebKit so there may be some quirks as well.

Prawn on the other hand is fully implemented in Ruby. It has no external dependencies (binary or otherwise). Prawn is a PDF spec implementation so it natively supports many features of the format. And while Prawn doesn't implement the spec 100% most of the useful features are implemented and well tested. Moreover, Prawn implements many optimizations (such as font subsetting, for example) that are not done by other gems.

Yet, you have to keep in mind that you will need to write Ruby code to generate your document with Prawn while Wicked PDF and PDFKit take HTML/CSS as input.

In short, Prawn gives you more control and produces better (smaller and more precise) documents but require Ruby coding. Wicked PDF/PDFKit are easier to use for people who only know HTML/CSS but resulting documents tend to be larger and less precise.

Hope that will help you to chose wisely.

Elton Santos

unread,
Feb 23, 2016, 1:04:55 PM2/23/16
to Prawn
I chose Prawn!!! Thanks Alexander, It was quite enlightening your answer!!! :D
Reply all
Reply to author
Forward
0 new messages