views:

324

answers:

3
+1  Q: 

HTML with Prawn

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?

A: 

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.

bobbywilson0
Prince XML would cost 3800 USD for my application... which is about 3800 USD above my budget
Arcath
+1  A: 

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.

Cratchitimo
Yeah ive decided to use that as a base for an extension my bbcode gem
Arcath
+1  A: 

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.

evaneykelen