简体   繁体   English

Prince是在Ruby on Rails中创建PDF的最佳方法吗?

[英]Is Prince the best way to create PDFs in Ruby on Rails?

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. 经过几次Google搜索后,似乎可以从HTML和CSS(相对于新的标记语言)在Rails中创建PDF的方法是使用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. 我的非大商业应用程序的许可价格为3800美元,我想知道这是否是共识,或者人们可以选择共享方法和方式。

You may check out prawn too. 您也可以检查 Tutorial can be found on railscasts.com . 可以在railscasts.com上找到教程。

这可能符合要求: http : //code.google.com/p/wkhtmltopdf/

We tried tow solutions: 我们尝试了以下两种解决方案:

  1. using latex generate pdf, there is ruby gem code rtex 用乳胶生成PDF,有红宝石宝石代码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. 使用java库iText ,使用它可能需要rjb ,它允许您直接在ruby代码中使用java lib,就像jruby一样,但是您不需要在jruby上构建所有应用程序。

I create tons of different PDF files on the fly from various data sources using Rails, including finest layout. 我使用Rails从各种数据源即时创建了大量不同的PDF文件,包括最佳布局。 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是完成此任务的最佳工具。

Prince's rendering quality & CSS support (better than some browsers) is its main selling point. Prince的渲染质量和CSS支持(优于某些浏览器)是其主要卖点。 If you're only generating documents with simple layouts, stick with Prawn. 如果仅生成具有简单布局的文档,请坚持使用Prawn。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM