Overview

Geraldo is a reports engine with its own API, created in Python language to output PDFs and other formats for complex reports.

Its workflow is the following:

  1. You declare a Report class with your report structure and definitions;
  2. Instantiate your Report class, informing a queryset with a list with objects;
  3. Call report’s ‘generate_by’ method, informing the generator class and filename output (can be a filename or file output). It will generate a file in hard disk or in memory;
  4. Do what you want with the output: you can return in a HttpResponse, keep it in a file, etc.

Features

Geraldo does most of what any reports engine does. We can feature the following:

  • A detail band, the report driver
  • Page header, Page footer, Report begin and Report summary bands
  • Groupping in multiples levels
  • SubReports to print childs
  • Multi-formats compatible in output (even if we have only PDF for a while)
  • Child bands, to attach helper bands to other ones
  • Support Django or any else Python framework/application
  • Graphics elements (including images and a sort of shapes)
  • System fields (to show report title, page numbers, current date/time, etc.)
  • Reports composition (you can reuse your bands for other reports)
  • Reports inheritance (you can use the same structure for a lot of reports)
  • A powerful stylizing support (colors, fonts, sizes, etc.)
  • Different page sizes
  • Flexibility to be easy customized
  • Aggregation functions
  • Hidding/showing bands and elements

Dependencies

Geraldo is fully dependent from ReportLab, not only because its PDF generation, but also its units and styles library. We have tested with ReportLab version 2.1

Geraldo is not Django dependent, but it can work as a Django pluggable application.

A very little demo with how Geraldo works

from geraldo import Report
from geraldo.generators import PDFGenerator

class MyReport(geraldo.Report):
    title = "Cars I have"

objects_list = User.objects.all() # If you are using Django

report = MyReport(queryset=objects_list)

report.generate_by(PDFGenerator, filename='cars_list.pdf')

This code above will output your report, driven by the queryset ‘objects_list’, into file ‘cars_list.pdf’.

Now, an example in a Django’s view:

from django.http import HttpResponse
from geraldo import Report
from geraldo.generators import PDFGenerator

class MyReport(geraldo.Report):
    title = "Cars I have"

def my_view(request):
    response = HttpResponse(mimetype='application/pdf')

    objects_list = User.objects.all() # If you are using Django
    report = MyReport(queryset=objects_list)

    report.generate_by(PDFGenerator, filename=resp)

    return response

As you can see, now returned the PDF output to HttpResponse, instead of a file.

License

Geraldo is under Lesser Gnu Public License, take a look on the following URL to read it:

http://www.gnu.org/copyleft/lesser.html

Authors

Geraldo has been created by Marinho Brandao a brazilian Django and Python enthusiast.

Home page: http://marinhobrandao.com/

E-mail: marinho at gmail dot com

Table Of Contents

Next topic

Tutorial 1

This Page