Rails Rails 如何将 HTML 转换成 PDF?

yhuiche · October 15, 2013 · Last by beyondyuqifeng replied at October 16, 2013 · 3674 hits

我在 rails 中使用 wkhtmltopdf 将 html 文件转换成 pdf 文件,能够很好地转换,但是发现有一两秒的生成时间,速度不够理想。有没有更加快速的方法??

gem 'wisepdf'

#1 楼 @sanivbyfish Wisepdf uses the shell utility wkhtmltopdf to serve a PDF file to a user from HTML. 还是 wkhtmltopdf...

去试试用 js 方式去生成 PDF

#2 楼 @yhuiche 他底层还是调用 wkhtmltopdf,我用起来感觉没差啊

#3 楼 @lang1pal 你可以扔到 queue 里面做,那么就不用等了

#3 楼 @lang1pal 我的 js 都还没入门。。。

#6 楼 @ericguo prawn 速度很快,但是样式的自己写,不能使用 html 已经调好的样式。。

用 wicked_pdf,也是基于 wkhtmltopdf 的,感觉速度还行啊?只是比正常的网页打开稍微慢点

You need to Sign in before reply, if you don't have an account, please Sign up first.