[reportlab-users] First report, complete with graph and database

Patrick Maupin pmaupin at gmail.com
Thu Feb 4 22:04:43 EST 2010


On Thu, Feb 4, 2010 at 8:50 PM, Bill Harris
<bill_harris at facilitatedsystems.com> wrote:

> Patrick Maupin <pmaupin at gmail.com> writes:

>

>> If your needs are simple and you haven't done any Python programming,

>> you might consider programatically generating reStructuredText, and

>> using rst2pdf (which uses reportlab under the hood).

>

> Pat,

>

> Thanks; I'll take a look.  I use asciidoc, which seems similar to

> reStructuredText.  (I'd use asciidoc, but I'd have to learn enough CSS

> or XSL to make DocBook create the one-page output I want.)

>

> It sounds as if reStructuredText doesn't handle the generation of a

> graph or the connection to a database, but I should be able to produce

> the reStructuredText source from a language I do use.


Ahhh, graphs.

Graphs (at least good vector graphs) are somewhat of a weakness of
rst2pdf (and somewhat of a strength of reportlab). The two different
methods for importing .svg into rst2pdf have some issues with things
like text labels.

If you can get your graph into a pdf all by itself (either by just
doing the graph alone in reportlab, or by generating a pdf from a
different package), then, with the current subversion version of
rst2pdf, you can use the "-e vectorpdf" option, and bring in the pdf
containing the graph as a vector image. That works pretty well for
non-compressed, non-password protected PDFs at the moment.

That's kind of convoluted, especially if you're using reportlab to
generate the graph PDF -- if the text is small compared to that, you
might as well just use reportlab for the whole job!

Hope that's not too confusing.

Regards,
Pat


More information about the reportlab-users mailing list