ANN: PollyReports 1.5 -- Band-oriented PDF Report Generator

Discussion in 'Python' started by Chris Gonnerman, Jul 11, 2012.

  1. I've held off announcing this until I was sure it was really stable;
    it's been 19 days since I made the last change to it, so here goes.
    PollyReports is my Python module for report generation. It is designed
    to be, quite literally, the "simplest thing that can possibly work" in
    the field of PDF generation from a database record set. There is a
    somewhat vague resemblance to GeraldoReports; I had problems with
    Geraldo's pagination which led me to develop PollyReports in a brief
    flurry of intense activity.

    It's on PyPI: http://pypi.python.org/pypi/PollyReports
    and on Github: https://github.com/Solomoriah/PollyReports
    and I have a blog where I talk about it (like anyone cares):
    http://opensource.gonnerman.org/?cat=4

    Here's the README:

    PollyReports.py
    Copyright (c) 2012 Chris Gonnerman
    All Rights Reserved
    See the LICENSE file for more information. (Note: BSD licensed)
    -----------------------------------------------------------------------------------------

    PollyReports.py provides a set of classes for database report writing.
    It assumes that you are using Reportlab to do PDF generation, but can
    work with any "canvas-like" object as desired.

    PollyReports provides the following framework for report generation:

    A Report object has a data source bound to it at instantiation. One or
    more Band objects (at least, a detail Band) must be added to it, and
    then the generate() method will be called to process the data source.
    The data source
    must be an iterator that produces objects that can be accessed via []
    operations, meaning mainly dict, list, and tuple types, i.e. the most
    common types of records returned by standard database modules. The
    detail band is
    generated() once for each row.

    Band objects contain a list of Elements (generally at least one) which
    define how data from the row should be printed. An Element may print
    any normal data item or label and may be subclassed to handle other
    things like images. Generating a band in turn calls Element.generate()
    for each element, producing a list of Renderers with the first item in
    the list being the overall height of the band. The height is used to
    decide if the band will fit on the current page; if not, a new page will
    be created first. When the page is finally ready for the band,
    Renderer.render() will be called for each Renderer in the element list
    in order to actually render the data.

    As noted above, PollyReports expects a Reportlab-like canvas interface.
    The module has been kept as clean as possible, so that, though I don't
    actually recommend it, it would not be insane to say

    from PollyReports import *

    Importing only what you expect to use is still a better idea, of course.

    --
    -------------------------------------------------------------------------------
    Chris Gonnerman <>
    Owner, New Century Computers
    Phone 660-213-3822 Fax 660-213-3339
    Chris Gonnerman, Jul 11, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Cropper
    Replies:
    0
    Views:
    211
    Simon Cropper
    Jul 12, 2012
  2. Chris Angelico
    Replies:
    0
    Views:
    192
    Chris Angelico
    Jul 12, 2012
  3. Andreas Perstinger
    Replies:
    0
    Views:
    200
    Andreas Perstinger
    Jul 12, 2012
  4. Rodrick Brown
    Replies:
    0
    Views:
    200
    Rodrick Brown
    Jul 12, 2012
  5. Chris Gonnerman
    Replies:
    0
    Views:
    200
    Chris Gonnerman
    Jul 12, 2012
Loading...

Share This Page