Pages

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:

www.reportlab.com

bitbucket.org/vasudevram/PySiteCreator

bitbucket.org/vasudevram/xtopdf

- Vasudev Ram
dancingbison.com

2 comments:

Please be on-topic and civil in your comments. Comments not following these guidelines will be deleted.