Pergunta

After several Google searches, it appears that the way to create PDFs in Rails from HTML and CSS (versus a new markup language) is to use Prince.

With licensing at $3800 for my non-big-commercial app, I'm wondering if this is, in fact, consensus or people have an alternative they can share the whats and hows.

Foi útil?

Solução

You may check out prawn too. Tutorial can be found on railscasts.com.

Outras dicas

This may fit the bill: http://code.google.com/p/wkhtmltopdf/

We tried tow solutions:

  1. using latex generate pdf, there is ruby gem code rtex
  2. using java library iText, use it you may need rjb which allow you using java lib directly in ruby code, just like jruby, but you don't need build all you application on jruby.

I create tons of different PDF files on the fly from various data sources using Rails, including finest layout. I create need to create them for presenting products to customers.

After having tried all the tools mentioned above, Prince is the best tool for this task.

Prince's rendering quality & CSS support (better than some browsers) is its main selling point. If you're only generating documents with simple layouts, stick with Prawn.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top