3 ms·
Prawn is pretty neat, but what I'd really like to see is HTML to PDF in pure Ruby. I had to use a Java library wrapped in a Ruby module to do this. Complicates
by rubeng 17y ago
Prawn is pretty neat, but what I'd really like to see is HTML to PDF in pure Ruby. I had to use a Java library wrapped in a Ruby module to do this. Complicates my server configuration (needs the JVM) more than I'd like.
- petesalty 17y agoYou can try HTMLDOC (http://htmldoc.rubyforge.org/ http://htmldoc.rubyforge.org/) which is a wrapper around a C library (I believe) that does exactly this. I've used it before, it's pretty fast and stable and you don't have to worry about JVM.
- jmonegro 17y agoThere are many webservices out there (paid and free) that do this for you. You might want to consider that instead.
- rufo 17y agoAny details you can share? I may have a need of something similar.
- sandal 17y agoThe best way to do this is FlyingSaucer via JRuby. https://xhtmlrenderer.dev.java.net/ https://xhtmlrenderer.dev.java.net/
- rubeng 17y agoYeah, I used Flying Saucer: https://xhtmlrenderer.dev.java.net/ https://xhtmlrenderer.dev.java.net/ Only, I needed to parse plain HTML (not just XHTML) so I'm using TagSoup as the replacement parser: http://home.ccil.org/~cowan/XML/tagsoup/ http://home.ccil.org/~cowan/XML/tagsoup/ This combination is awesome.
- sandal 17y agoI'm the maintainer of Prawn, and yeah, it'd be nice to see this. Jamis Buck tried this with prawn-format, but after a while we dropped support for it because it fell behind our core library and started breaking (Jamis had since moved on to other things). In order for this to happen, what we really need is a solid box model. Since we don't have that yet, it's a very hard problem. If someone wanted to pay me to work on it full time for a year, I could get it built. But failing that, we'll have to wait a good deal of time for this, unless someone else finds a large chunk of dedicated time for it. Until then, Flying Saucer is the way to go if you can't afford PrinceXML price tag.
- rubeng 17y agoAgreed. That's what I ended up using and it's fantastic. Great CSS support and coupled with the TagSoup parser, you can convert almost anything.
- oomkiller 17y agoTry Princely (blog post: http://jimneath.org/2009/02/16/creating-pdf-documents-in-ruby-on-rails/ http://jimneath.org/2009/02/16/creating-pdf-documents-in-rub...) http://github.com/mbleigh/princely http://github.com/mbleigh/princely
- rubeng 17y agoThat's just a wrapper over Prince XML, I ended up writing my own wrapper over Flying Saucer: https://xhtmlrenderer.dev.java.net/ https://xhtmlrenderer.dev.java.net/
- jdelsman 17y ago+1. This is much better than the current prawn/prawnto DSL. Its just much more recognisable as a language to create PDFs in HTML/CSS.