从 Rails 的 HTML 页面生成 PDF [英] PDF generation from HTML page for Rails

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

问题描述

我正在寻找一种将 HTML 视图页面从 Rails 转换为 PDF 的工具.我希望样式完好无损,并且应该能够识别 CSS 样式.我听说过 Prince XML 和 Wicked PDF.我想知道使用其中之一的优缺点.另外,我想知道PDF的渲染是否有任何关于样式的问题(样式是否会被正确渲染).如果有其他工具,请告知.

I am looking for a tool to convert HTML view pages to PDF from Rails. I want the styles to be intact and should be able to identify CSS styles. I have heard of Prince XML and Wicked PDF. I want to know the advantages and disadvantages of using one of them. Also, I want to know whether the rendering of PDF has any problems with regard to the style(whether style will be properly rendered). If there is any other tools, please inform about them.

谢谢,王子

推荐答案

PDFkit从我所看到的来看相当不错,但我是 wicked_pdf 对于细粒度的控制,您可以处理您的文档.

PDFkit is pretty nice from what I've seen, but I'm a big fan of wicked_pdf for the fine-grained control you can get over your documents.

PrinceXMLprincely 很棒,但是很贵.DocRaptor 是一个很棒的网络服务,可以让您涉足其中,但王子唯一的东西确实比基于 wkhtmltopdf 的免费解决方案做得更好的是它能够正确地进行分页,而无需切割表格行和重复标题.

PrinceXML and princely are great, but expensive. DocRaptor is a great web service that can let you dip your toes in, but the only things prince really does better than the free wkhtmltopdf-based solutions are its ability to properly do page-breaks without cutting table rows and repeating headers.

免责声明:我是 wicked_pdf 的维护者之一,也是运行 DocRaptor 的人的好朋友.

Disclaimer: I am one of the maintainers of wicked_pdf, and good friends with the people who run DocRaptor.

这篇关于从 Rails 的 HTML 页面生成 PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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