Rails 3 和 Prawn - HTML 格式不起作用?
我打开Prawn的手册页面并尝试在PDF文档中使用HTML格式。具体来说,
pdf.table([["Just <font size='18'>some</font> <b><i>inline</i></b>", "", ""],
["<color rgb='FF00FF'>styles</color> being applied here", "", ""]],
:cell_style => { :inline_format => true }, :cell_style => {:borders => []})
问题是,HTML标签显示为HTML标签,有人有同样的问题吗?根据文档,HTML 标签应该显示 HTML 属性,但实际上仅显示 HTML 标签。
有人提示如何修复它吗?
我用的版本是Prawn
* prawn (0.12.0)
* prawnto (0.0.4)
I opened Prawn's manual page and try to use HTML formatting in PDF document. Specifically,
pdf.table([["Just <font size='18'>some</font> <b><i>inline</i></b>", "", ""],
["<color rgb='FF00FF'>styles</color> being applied here", "", ""]],
:cell_style => { :inline_format => true }, :cell_style => {:borders => []})
The problem is, that the HTML tags are displayd as the HTML tags, have anyone the same problem? By the documentation the HTML tags should display a HTML property, but in fact are displayed only HTML tags.
Have anyone a tip how to fix it?
I use the Prawn in the version
* prawn (0.12.0)
* prawnto (0.0.4)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它看起来不再是这样的( Prawn html 格式化 ) - 如果你想使用HTML 来制作 PDF,您可以使用 PDFKit ( https://github.com/jdpace/PDFKit )也支持 CSS。
It doesn't look like this is supposed anymore ( Prawn html formatting ) -- if you want to use HTML to make your PDF's you can use PDFKit ( https://github.com/jdpace/PDFKit ) which also supports CSS.
我已经使用 prawn 来创建 pdf,如果你接受我的意见,你不需要在 Rails 3 中使用 prawnto gem 和 prawn。
我刚刚就此创建了一个博客。看看这个,我已经从头开始解释了如何使用虾和示例发票。
http://www.idyllic- software.com/blog/creating-pdf-using-prawn-in-ruby-on-rails/
感谢
aniket
I have used prawn to create the pdf and if u take my opinion u dont need to use the prawnto gem with prawn in rails 3.
i have just created a blog on this.check this out i have explained it from scratch on how to use prawn with the sample invoice.
http://www.idyllic-software.com/blog/creating-pdf-using-prawn-in-ruby-on-rails/
thanks
aniket