WickedPDF vs PDFKit vs. Prawn, etc.

267 views
Skip to first unread message

Garrett Lancaster

unread,
Jan 12, 2011, 5:54:53 PM1/12/11
to rubyonra...@googlegroups.com
Thoughts on using WickedPDF vs PDFKit vs. Prawn or others for developing
forms with dynamic content?

TIA,
Garrett Lancaster

Marnen Laibow-Koser

unread,
Jan 12, 2011, 6:32:12 PM1/12/11
to rubyonra...@googlegroups.com
Garrett Lancaster wrote in post #974445:

> Thoughts on using WickedPDF vs PDFKit vs. Prawn or others for developing
> forms with dynamic content?

I use Prawn, and might try WickedPDF at some point. Correct me if I'm
wrong, but isn't PDFKit meant for manipulating existing PDF files, not
producing them from scratch, unlike the other two?

>
> TIA,
> Garrett Lancaster

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Sent from my iPhone

--
Posted via http://www.ruby-forum.com/.

Amar Daxini

unread,
Jan 13, 2011, 1:40:12 AM1/13/11
to rubyonra...@googlegroups.com
Marnen Laibow-Koser wrote in post #974456:

> Garrett Lancaster wrote in post #974445:
>> Thoughts on using WickedPDF vs PDFKit vs. Prawn or others for developing
>> forms with dynamic content?
>
You can use Flying Saucer Library.Which convert XHTML to PDF.
It also support css 2.1.So there is less change in your view.
You can install plugin
http://github.com/amardaxini/acts_as_flying_saucer.
You can search more on http://railstech.com/tag/act_as_flying_saucer/

t.pickett66

unread,
Jan 12, 2011, 9:20:33 PM1/12/11
to Ruby on Rails: Talk


On Jan 12, 5:32 pm, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
> Garrett Lancaster wrote in post #974445:
>
> > Thoughts on using WickedPDF vs PDFKit vs. Prawn or others for developing
> > forms with dynamic content?
At the company I work for we have used both Prawn(early on) and
PDFKit(newer projects) with a strong preference for PDFKit given
everyone's familiarity with HTML+CSS we use it to automate filling out
of medicaid application forms which are ridiculously complex and have
yet to have one rejected for not being correct. It does take some
getting used to working in inches/cm rather than px for layouts since
you're working in the print profile for CSS but that isn't required
just preferred by some. As for WickedPDF I've got no experience with
it so can't speak to its usefulness.

> I use Prawn, and might try WickedPDF at some point.  Correct me if I'm
> wrong, but isn't PDFKit meant for manipulating existing PDF files, not
> producing them from scratch, unlike the other two?

No, PDFkit is based on wkhtmltopdf (quite a mouthful) which takes HTML
+ CSS and turns it into a fresh PDF.

Marnen Laibow-Koser

unread,
Jan 13, 2011, 8:46:44 AM1/13/11
to rubyonra...@googlegroups.com
t.pickett66 wrote in post #974551:
[...]

>> I use Prawn, and might try WickedPDF at some point. Correct me if I'm
>> wrong, but isn't PDFKit meant for manipulating existing PDF files, not
>> producing them from scratch, unlike the other two?
>
> No, PDFkit is based on wkhtmltopdf (quite a mouthful)

As is Wicked.

> which takes HTML
> + CSS and turns it into a fresh PDF.

Good to know. I think I was confusing it with pdftk.

Paul

unread,
Jan 13, 2011, 9:48:56 AM1/13/11
to rubyonra...@googlegroups.com
I've played around with all three and have found them all to work if
you don't care about exact placement of items. They tend to limit your
formatting choices. The largest pain I had was getting wkhtmltopdf
installed and acting the same way on my server as it did on my
development machine. (The problems, after struggling with
dependencies, had to do with scaling and fonts.)

For my app, I found it easier to not use any of the gems, but just
call `wkhtmltopdf ...` directly, but it depends on what you are trying
to do.

Walter Lee Davis

unread,
Jan 13, 2011, 11:38:49 AM1/13/11
to rubyonra...@googlegroups.com

On Jan 13, 2011, at 9:48 AM, Paul wrote:

> I've played around with all three and have found them all to work if
> you don't care about exact placement of items. They tend to limit your
> formatting choices. The largest pain I had was getting wkhtmltopdf
> installed and acting the same way on my server as it did on my
> development machine. (The problems, after struggling with
> dependencies, had to do with scaling and fonts.)
>
> For my app, I found it easier to not use any of the gems, but just
> call `wkhtmltopdf ...` directly, but it depends on what you are trying
> to do.

I've used PrinceXML in another (PHP) project. If you can find a
wrapper in Rails to use that, I recommend it heartily. It can make
really lovely CSS-controlled PDF layouts. It's costly, but very very
effective.

Walter

>
> On Wed, Jan 12, 2011 at 5:54 PM, Garrett Lancaster
> <glan...@garrettlancaster.com> wrote:
>> Thoughts on using WickedPDF vs PDFKit vs. Prawn or others for
>> developing
>> forms with dynamic content?
>>
>> TIA,
>> Garrett Lancaster
>>
>

> --
> You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-
> ta...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
> .
>

Garrett Lancaster

unread,
Jan 13, 2011, 12:02:58 PM1/13/11
to rubyonra...@googlegroups.com
On Jan 13, 2011, at 9:48 AM, Paul wrote:
> I've played around with all three and have found them all to work if
> you don't care about exact placement of items. They tend to limit your
> formatting choices.
I don't think I need to do anything too complex with the formatting
(probably a lot of tables for the most part), but could you be more
specific about the types of limitations you found? Also, I noticed
wkhtmltopdf is GPL'ed...any legal ramifications to invoking it from a
proprietary app? As far as my understanding goes, invoking it does not
fall under the jurisdiction of the license, but not sure.

Walter Lee Davis wrote:
> It's costly, but very very effective.


Thanks for the recommendation, but don't have a spare 3800 lying around ;)


David Kahn

unread,
Jan 13, 2011, 12:40:07 PM1/13/11
to rubyonra...@googlegroups.com


On Thu, Jan 13, 2011 at 10:47 AM, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
Walter Davis wrote in post #974668:

> On Jan 13, 2011, at 9:48 AM, Paul wrote:
>
>> I've played around with all three and have found them all to work if
>> you don't care about exact placement of items. They tend to limit your
>> formatting choices. The largest pain I had was getting wkhtmltopdf
>> installed and acting the same way on my server as it did on my
>> development machine. (The problems, after struggling with
>> dependencies, had to do with scaling and fonts.)
>>
>> For my app, I found it easier to not use any of the gems, but just
>> call `wkhtmltopdf ...` directly, but it depends on what you are trying
>> to do.
>
> I've used PrinceXML in another (PHP) project. If you can find a
> wrapper in Rails to use that, I recommend it heartily.

That would be the Princely plugin.  Or just shell out to it.


> It can make
> really lovely CSS-controlled PDF layouts. It's costly, but very very
> effective.

My understanding is that wk is nearly as good without the $3000 price
tag, but I've never used either.

My experience has been that I ate up what would have been a lot of the $3k price by using wkhtmltopdf. Definitely issues with installation (going from mac to ubuntu), issues with rendering on ubuntu (requiring need to install a static binary which patches QT), inconsistencies as to whether it renders links or not (I found that using the gems that my wkhtmltopdf was not rendering links, so I dropped using the gems and went to use wkhtmltopdf directly)... anyhow, I did write a couple blog posts on the subject which maybe would be helpful:

http://blog.structuralartistry.com/post/2316402105/using-wkhtmltopdf-with-ruby-and-rails
http://blog.structuralartistry.com/post/2327213260/installing-wkhtmltopdf-on-ubuntu-server

 

>
> Walter


Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.

Walter Lee Davis

unread,
Jan 13, 2011, 12:49:09 PM1/13/11
to rubyonra...@googlegroups.com

On Jan 13, 2011, at 12:02 PM, Garrett Lancaster wrote:

>> It's costly, but very very effective.
>
>
> Thanks for the recommendation, but don't have a spare 3800 lying
> around ;)


Thankfully, my client qualified for the EDU discount, as they're a non-
profit educational foundation. It is steep, but it saved me from what
could have become another 6 months of heartache trying to get one of
the various open-source systems to work with the less-than-perfect
HTML I had to work from. Compared with my fees for that time period,
even full price would have been a rounding error! I think I got it
working in less than a week.

Walter

Paul

unread,
Jan 13, 2011, 3:56:34 PM1/13/11
to rubyonra...@googlegroups.com
Nice posts! I wish you had written them back when I was experimenting.

I don't remember all the details of the problems I ran into. Prawn has
a different language (not HTML) and has terrible diagnostic messages
and documentation, so you can change a small thing and suddenly have
no output and just have to experiment until you figure out what it's
doing.

I don't remember exactly why I decided to bypass the wkhtmltopdf-based
gems, but I remember that some code that didn't output what I expected
in the gem worked fine when I just called wkhtmltopdf directly.

I completely agree with the pain of installing. I'd say the first
thing to do is write a really simple webpage and pass it to
wkhtmltopdf on your development machine and your server. Use a couple
different fonts and more than one page's worth, and perhaps some
unusual css.

David Kahn

unread,
Jan 13, 2011, 4:12:05 PM1/13/11
to rubyonra...@googlegroups.com
On Thu, Jan 13, 2011 at 2:56 PM, Paul <pa...@nines.org> wrote:
Nice posts! I wish you had written them back when I was experimenting.

I don't remember all the details of the problems I ran into. Prawn has
a different language (not HTML) and has terrible diagnostic messages
and documentation, so you can change a small thing and suddenly have
no output and just have to experiment until you figure out what it's
doing.

Timely thread... I was planning to implement Prawn today on an new project and not use wkhtmltopdf.... but oh god, I have to learn another DSL :(   

Wkhtmltopdf starting to look a lot happier right now!
 

I don't remember exactly why I decided to bypass the wkhtmltopdf-based
gems, but I remember that some code that didn't output what I expected
in the gem worked fine when I just called wkhtmltopdf directly.

I completely agree with the pain of installing. I'd say the first
thing to do is write a really simple webpage and pass it to
wkhtmltopdf on your development machine and your server. Use a couple
different fonts and more than one page's worth, and perhaps some
unusual css.

Marnen Laibow-Koser

unread,
Jan 13, 2011, 4:17:01 PM1/13/11
to rubyonra...@googlegroups.com
David Kahn wrote in post #974766:

> On Thu, Jan 13, 2011 at 2:56 PM, Paul <pa...@nines.org> wrote:
>
>> Nice posts! I wish you had written them back when I was experimenting.
>>
>> I don't remember all the details of the problems I ran into. Prawn has
>> a different language (not HTML) and has terrible diagnostic messages
>> and documentation, so you can change a small thing and suddenly have
>> no output and just have to experiment until you figure out what it's
>> doing.
>>
>
> Timely thread... I was planning to implement Prawn today on an new
> project
> and not use wkhtmltopdf.... but oh god, I have to learn another DSL :(

Prawn markup is easy enough. What the hell is wrong with learning a
DSL? Both with this and with Cucumber, you say "learning a DSL" like
it's a bad thing.

Anyway, if you use prawn_format, you can control Prawn with HTML, though
I don't know how well that works.

>
> Wkhtmltopdf starting to look a lot happier right now!

Best,

David Kahn

unread,
Jan 13, 2011, 4:35:06 PM1/13/11
to rubyonra...@googlegroups.com
On Thu, Jan 13, 2011 at 3:17 PM, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
David Kahn wrote in post #974766:
> On Thu, Jan 13, 2011 at 2:56 PM, Paul <pa...@nines.org> wrote:
>
>> Nice posts! I wish you had written them back when I was experimenting.
>>
>> I don't remember all the details of the problems I ran into. Prawn has
>> a different language (not HTML) and has terrible diagnostic messages
>> and documentation, so you can change a small thing and suddenly have
>> no output and just have to experiment until you figure out what it's
>> doing.
>>
>
> Timely thread... I was planning to implement Prawn today on an new
> project
> and not use wkhtmltopdf.... but oh god, I have to learn another DSL :(

Prawn markup is easy enough.  What the hell is wrong with learning a
DSL?  Both with this and with Cucumber, you say "learning a DSL" like
it's a bad thing.

You remember :) My thing is that if I can hammer out an html doc in 10 minutes, how much trial and error am I going to go through to get it out in a new DSL? It's just a question of where I (and clients) are going to benefit.
 

Anyway, if you use prawn_format, you can control Prawn with HTML, though
I don't know how well that works.

Interesting... but looks like is no longer being maintained after Prawn 0.7: https://github.com/sandal/prawn-format

 

>
> Wkhtmltopdf starting to look a lot happier right now!

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

--
Posted via http://www.ruby-forum.com/.

--
Reply all
Reply to author
Forward
0 new messages