HTML with Prawn

佐手、 提交于 2019-12-13 15:52:01

问题


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?


回答1:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/2019793/html-with-prawn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!