简体   繁体   English

Rails 3和Prawn-HTML格式不起作用?

[英]Rails 3 and Prawn - HTML formatting doesn't work?

I opened Prawn's manual page and try to use HTML formatting in PDF document. 我打开了Prawn的手册页,并尝试在PDF文档中使用HTML格式。 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? 问题是,HTML标记显示为HTML标记,有人遇到同样的问题吗? By the documentation the HTML tags should display a HTML property, but in fact are displayed only HTML tags. 根据文档,HTML标记应显示HTML属性,但实际上仅显示HTML标记。

Have anyone a tip how to fix it? 有没有人提示如何解决?

I use the Prawn in the version 我在版本中使用大虾

* prawn (0.12.0)
* prawnto (0.0.4)

它看起来不再像这样( Prawn html formatting )-如果您想使用HTML来制作PDF,可以使用也支持CSS的PDFKit( https://github.com/jdpace/PDFKit )。

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. 我已经使用大虾创建了pdf,如果您认为我不需要使用大虾在Rails 3中使用大虾宝石。我刚刚在this.checkbox上创建了一个博客。我已经从头开始解释了如何使用它虾与样品发票。
http://www.idyllic-software.com/blog/creating-pdf-using-prawn-in-ruby-on-rails/ http://www.idyllic-software.com/blog/creating-pdf-using-prawn-in-ruby-on-rails/

thanks 谢谢

aniket aniket

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM