Quick PDF generation with RTex
Posted by marcel March 19, 2006 @ 11:02 PM
Bruce Williams of Naviance recently announced his RTex plugin. It exposes your controller data to rtex views that output LaTeX which is convereted to PDF.
To install you can use the plugin script:
ruby script/plugin install rtex
Or grab it from svn:
svn co http://codefluency.com/svn/codefluency/rails/plugins/rtex
People have used PDF::Writer to generated .rpdf views. Why go through LaTex to get to PDF rather than use PDF::Writer? Speed, says Bruce.

Cool! I was planning on figuring out how to generate PDFs in Rails in the near future.
The speed issue is real. We would love to use PDF::Writer for what we’re doing (at Naviance). The API is beautiful and it’s really feature-rich. But it doesn’t go fast enough for us, and we don’t have time (yet) to work on speeding it up. The mainly arises when you’re dealing with, say, several hundred or more rows in a table. PDF::Writer really doesn’t like that.
Nice. This tool might be helpful.
Nice. This tool might be helpful.
pdflatex only in *nix world
pdfTeX is available for Windows or Mac OS X as well as Linux. You can find more info here: http://www.tug.org/applications/pdftex/
One for Windows is proTeXt: http://www.tug.org/protext/
-Tom
FYI, PDFlib released Ruby bindings this month. Yet another option.
PDFlib certainly is a good option in terms of speed.
I do think that LaTeX includes quite a few advanced, professional-level layout and typesetting capabilities that would be quite painful to duplicate manually with PDFlib, however—especially when you start dealing with long, complex documents with figures, tables, and floats.
LaTeX and speed? You must be joking! Take a look at reportlab to see what speed actually means:
http://www.reportlab.org/
(and, BTW, you don’t have to generate ugly TeX files)