Rails:将 HTML 转换为 PDF? [英] Rails: Convert HTML to PDF?

查看:38
本文介绍了Rails:将 HTML 转换为 PDF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取 HTML 并将其转换为 PDF 的最佳和最简单的方法是什么,类似于在 ColdFusion 上使用 CFDOCUMENT?

What is the best and easiest way of taking HTML and converting it into a PDF, similar to use CFDOCUMENT on ColdFusion?

更新:我真的很感谢人们到目前为止给出的所有评论和建议,但是我觉得人们留下他们的答案没有抓住要点.

UPDATE: I really appreciate all the comments and suggestions that people have given so far, however I feel that people leaving their answers are missing the point.

1) 解决方案必须是免费的或开源的.一个人建议使用 pricexml 和另一个 pd4ml.这两种解决方案都需要花钱(pricexml 需要花费一条胳膊和一条腿),而我并不是要花钱.

1) the solution has to be free or open sourced. one person suggested using pricexml and the other pd4ml. both of these solutions costs money (pricexml costing an arm and a leg) which i'm not about the fork over.

2) 他们必须能够接收 html(来自文件、url 或字符串变量),然后生成 pdf.像 prawn、rprf、rtex 这样的库是使用自己的方法生成的,而不是采用 html.

2) they must be able to take in html (either from a file, url or a string variable) and then produce the pdf. libraries like prawn, rprf, rtex are produced using their own methods and not taking in html.

请不要认为我对这些建议不怀好意,只是对于像我这样使用 ColdFusion 但想转换为 Rails 的人来说,生成 pdf 似乎是一个真正的问题.

please don't think i'm ungrateful for the suggestions, it's just that pdf generation seems like a really problem for people like me who use ColdFusion but want to convert to Rails.

推荐答案

The gem, WickedPDF正是那个.

The gem, WickedPDF, does exactly that.

这篇关于Rails:将 HTML 转换为 PDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆