JSON data + RML template = PDF report

Summary

[EuroPython 2011] Stefano Cotta Ramusino - 23 June 2011 in "Track Ravioli"

Description

The main problem with reports generated in Python is how to separate the content from the style using ReportLab library, because all informations should be saved in a single source file that, by example, is impossible to understand for your graphic designer.

So the solution: just modularizes all components you need and identify simple container formats for your data input (JSON) and document template (ReportLab RML).

Now with the power of Genshi and XInclude we will create dynamic templates that include specific snippets (e.g., to generate on the fly a decent graph with matplotlib or cairoplot to fill some lacks of ReportLab) and we will detach the stylesheet from the template structure.

And at the end you can also have the internationalization service in the PDF report generation!