Wednesday, January 30, 2013

PDFDocument, a ReportLab wrapper

matthiask/pdfdocument · GitHub

Saw it via StackOverflow.

PDFDocument is a wrapper for Reportlab that makes it easier to create PDF documents. Interesting approach.

It  provides methods, such as pdf.h1("A heading"), to generate the HTML-like markup that ReportLab supports. Many HTML-generation tools, including my PySiteCreator tool (which is meant for writing web sites in Python), use a similar approach.

I used a different approach in my xtopdf toolkit, which is also a ReportLab-based library (and also a set of end-user tools), for PDF generation from text, DBF, CSV, TDV/TSV and XLS content. The PDFWriter module/class in xtopdf provides methods like pw.setFont(fontname) and pw.writeLine(text) to create PDF content.

PDFDocument has two templates, for letters and reports, which differ only in the first page. It also has a special template, confidential reports, which uses watermarks.

Related links:

- Vasudev Ram


Anonymous said...

fyi, there is

Vasudev Ram said...

Thanks, will check it out.