views:

193

answers:

2

I need to produce somewhat complicated PDFs from a Rails app - tables with column spans, styling, nested tables etc

I've looked at Prawn and I'm not sure it provides enough flexibility and HTMLDOC seems to be severely lacking in CSS support,

are there any other options out there?

thanks,

john.

A: 

Have you tried PDF::Writer?

kgiannakakis
isn't prawn built on top of pdf::writer - I'll certainly check it out though
jbeynon
+2  A: 

Disclaimer: I'm a regular committer to the prawn project.

Prawn isn't built on top of PDF::Writer - it's a replacement written from the ground up that avoids many of the limitations. I'd advise against PDF::Writer. It's old, difficult to use and doesn't support Unicode text.

Depending on the kind of document you need to generate, you have a few options:

RTex is a rails plugin that uses latex to generate PDF output. If you need to generate a formatted document with lots of text and you're happy with the (huge) latex dependency, it's a nice solution.

If you like the idea of a HTML->PDF conversion (like HTMLdoc but you know... good), you could try PrinceXML. There's a free version, but it watermarks the output. The licensed version is a few thousand dollars. The output is great, thanks to useful CSS support. There is at least 1 plugin that helps you integrate Prince with Rails - princely.

For generating the output with Ruby syntax, Prawn is your best option. Manually building the pages of your output gives you plenty of fine grained control, but you can get bogged down in co-ordinate maths. It's also not capable of at least one of the features you require - nested tables.

Which one works for you really depends on the style of document you need to generate.

James Healy
yeah, I got PrinceXML up and running in seconds but obviously the price tag attached was a none started.
jbeynon