PDF generation - wicked pdf / wkhtmltopdf

870 views
Skip to first unread message

Kevin Bedell

unread,
Aug 2, 2012, 1:15:56 PM8/2/12
to boston-r...@googlegroups.com
Has anyone used wicked_pdf and wkhtmltopdf to generate pdf files from rails?

wkhtmltopdf ( http://code.google.com/p/wkhtmltopdf/ ) is an c++
executable that the wicked_pdf gem (
https://github.com/mileszs/wicked_pdf ) essentially wraps. It works
great for basic pdf generation of tables and reports.

We're now looking to print some pages that have a lot of javascript
content. Since the processing is all done server-side, there's
obviously no browser to interpret the javascript.

I've been looking around and can see that wkhtmltopdf supports some
Javascript, but I'm also seeing that a lot of people are running into
problems using it for complex javascript rendering.

Anyone here have any experience with it?

-Kevin

Ben Tucker

unread,
Aug 2, 2012, 2:07:12 PM8/2/12
to boston-r...@googlegroups.com
We've used it pretty extensively (wkhtmltopdf that is, we don't use wicked_pdf, but instead wrote our own little ruby wrapper).  Basically it's fantastic until it gets caught up on something & then it can be very time consuming to debug.  It's was still the best solution we found without going down the road of Prince.  Unfortunately, the project hasn't seen a lot of attention in the last year, so they're running on a relatively old webkit version.

It's worth taking a look at PhantomJS: http://code.google.com/p/phantomjs/ which does a lot more than just letting you headlessly generate PDFs.  I haven't used it yet, though.

-Ben 


-Kevin

--
You received this message because you are subscribed to the Boston Ruby Group mailing list
To post to this group, send email to boston-r...@googlegroups.com
To unsubscribe from this group, send email to boston-rubygro...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/boston-rubygroup

Jay McGaffigan

unread,
Aug 2, 2012, 2:11:37 PM8/2/12
to boston-r...@googlegroups.com
We use Prince to convert HTML to PDF. It's got some support for
Javascript but we don't do a lot with javascript. But we've been very
happy with Prince overall

http://www.princexml.com/doc/8.1/javascript/


Jay

Eric Beland

unread,
Aug 2, 2012, 2:27:05 PM8/2/12
to boston-r...@googlegroups.com
I've wicked_pdf/wkhtmltopdf in one of our projects with no complaints. I can't say our project was javascript-heavy per se, but we had no problems. I'm wondering what kind of problems people see?  

Kevin Bedell

unread,
Aug 2, 2012, 2:38:09 PM8/2/12
to boston-r...@googlegroups.com
If you search the wkhtmltopdf issues list for 'javascript', there are
about 60 open issues.

http://code.google.com/p/wkhtmltopdf/issues/list

Many of the issues aren't significant, but there are a number of
issues with things like Google Charts and other heavy javascript
libraries. I was just wondering if anyone here had any experience to
share.

-Kevin

Clifton King

unread,
Aug 2, 2012, 3:46:30 PM8/2/12
to boston-r...@googlegroups.com
We've been using wicked_pdf for some time and have definitely ran into the same issues. There are also some fundamental design problems like page breaks, header and footer styling, etc that can make it a pain. I'd definitely recommend it for simple use-cases as long as you are okay trade-offs
Reply all
Reply to author
Forward
0 new messages