HTML with Prawn

2019-07-13 02:48发布

Im trying to use prawn to generate a PDF of a log entry, then entries are stored in bbcode ([b]bold[/b] etc...) and is converted to html on display.

Is there any way to display the html in prawn?

3条回答
We Are One
2楼-- · 2019-07-13 02:54

It sounds like prawn-format might be what you're looking for, but you'll need to use an older version of prawn if you want to try it out.

查看更多
乱世女痞
3楼-- · 2019-07-13 03:00

You'll probably get the best results if you use a lexical analyser such as 'Syntax' by Jamis Buck (http://syntax.rubyforge.org/) and parse the interesting parts of the HTML chunk and render those parts to PDF.

查看更多
虎瘦雄心在
4楼-- · 2019-07-13 03:05

You can use http://www.princexml.com/ to convert html docs to css, or use the princely plugin to render a pdf as one of the accepted formats of your view. See http://jimneath.org/2009/02/16/creating-pdf-documents-in-ruby-on-rails/

If you are wanting to use prawn directly I don't think there is a way to just use html directly to convert to pdf.

查看更多
登录 后发表回答