WickedPDF vs PDFKit vs. Prawn, etc.

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

TIA,
Garrett Lancaster

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,

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 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 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.

Best,

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 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

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 :wink:

Walter Davis wrote in post #974668:

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

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

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.

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 :frowning:

Wkhtmltopdf starting to look a lot happier right now!

David Kahn wrote in post #974766:

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 :frowning:

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 wrote in post #974766:

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 :frowning:

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 :slight_smile: 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