Rails:将HTML转换为PDF? [英] Rails: Convert HTML to PDF?
问题描述
与在ColdFusion上使用CFDOCUMENT相似,采用HTML并将其转换为PDF的最佳和最简便的方法是什么?
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.
推荐答案
宝石 WickedPDF 确实完全是.
The gem, WickedPDF, does exactly that.
这篇关于Rails:将HTML转换为PDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!