Tutorial :Creating on-demand, print-quality PDFs (preferably in Ruby if feasible)



Question:

Main-Question

What's your fast and reliable (as in "stable") solution to create on-demand, newspaper-like (as in "using advanced layout or typesetting") PDFs out of an application on a Linux server?

Therefore: No, HTML2PDF is not the solution I'm looking for. ;-)


Bonus-Question

And if it's not Ruby-based: Is there a way to steer your solution out of a Rails application? Preferably over a webservice or a something-2-Ruby-bridge-kind-of-thing?

Thanks a lot for your suggestions!

Update

There's a similar question and the rtex gem suggested there looks like what I'm looking for. I'll keep this question unanswered to look if there are other suggestions.


Solution:1

Typesetting well is hard.

If you can't find a ruby typesetting library, you may want to look at running a background pdflatex. LaTeX source is pretty easy to generate programmatically.

How useful this idea is will depend a bit on how complicated your documents are, and how much you care about the quality of output. If you have simple text only, and only want something a bit better than html, you probably have more options.


Solution:2

Prawn is designed for this type of thing, and it's under current development.


Solution:3

With php I've had great luck with FPDF. I generate a few thousand high quality reports everyday with it. Never misses a beat and is pretty quick. With php running on a webserver, I imagein it wouldn't be too hard to setup ruby to feed the php page the data required to generate and then ruby pick up the result.

EDIT: It looks like there is a port for Ruby. http://zeropluszero.com/software/fpdf/


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »