Covert HTML to PDF

Hello Everyone,

I am working on a website where I am required to convert an HTML view
into a PDF document. I have found some gems and plug-ins like
PDF::Writer, but none of these are good for converting HTML and CSS to
PDF file.

I found a gem called "Princely" which works with "PrinceXML". But
PrinceXML library is not free and we don't have money to pay for it as
we are non-profit.

Anyone who knows of a gem or plug-in that will best fit my scenario?

Thanks a lot!

look to wkhtml2pdf

Ivan Nastyukhin

I was also going to suggest wkthml2pdf… but in the easy to use form of a plugin called wicked_pdf…

See this tutorial…

You could also just try and e-mail the guys at Prince and present them with your case and ask if they would be interested in sponsoring your non-profit project (in exchange for some kind of promotional banner or mentioning Prince perhaps).

Best regards

Peter De Berdt

its easy use pdf-kit )

Ivan Nastyukhin

Thanks Everyone for your suggestions.
Appreciate your time and reply!

Hi Everybody,

I am using wicked_pdf plugin and having a hard time to get it working.
On windows XP, I get the error "fork() function is unimplemented on this
and on Mac OSX Snow Leopard, I get "Broken pipe" error.

Any help is much appreciated!


Did you first install the wkhtmltopdf utility? it’s not installed automatically as part of the plugin because it’s platform-specific…

Hi Joshua ,

I did install wkhtmltopdf.

I have given pdfkit a try which is working very well if I give it an
address like "".
Just don't know how to specify the address of a page from within my app.
Giving address like "http://localhost:3000/test" is not working.

Here is the code for pdfkit:
     format.pdf do
        kit ="")
        send_data(kit.to_pdf, :filename => "New.pdf", :type =>


If you are a non profit organization, you have a chance to obtain a nice
html to pdf converting library - PD4ML for
Ruby for free from Just contact them.

I use a PDF converter driver found on the internet . Install it and it
becomes a selectable converter option.Then you can convert PDFs to many
forms in any program at all, including Adobe Acrobat . Just open a PDF,
select convert, and choice a form you want, then you can convert pdf to
html and vice versa.the task will be finished in several seconds. if you
haven't found a good choice , you can have a try. best wishes.