Hacker News new | past | comments | ask | show | jobs | submit login

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.



I'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.


Agreed. 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.



That's just a wrapper over Prince XML, I ended up writing my own wrapper over Flying Saucer: https://xhtmlrenderer.dev.java.net/


You can try HTMLDOC (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.


There are many webservices out there (paid and free) that do this for you. You might want to consider that instead.


Any details you can share? I may have a need of something similar.


The best way to do this is FlyingSaucer via JRuby.

https://xhtmlrenderer.dev.java.net/


I thought about that but I didn't want my entire app running within the JVM.


You probably wouldn't have to do that. Check into something like resque: http://github.com/defunkt/resque

(depends upon your needs, of course)


Yeah, I used Flying Saucer: 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/

This combination is awesome.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: