# FirebirdToPDF.py # Author: Vasudev Ram - http://jugad2.blogspot.com # Demo program to show how to convert Firebird RDBMS data to PDF. # Uses xtopdf, Reportlab, Firebird RDBMS and fdb Python driver for Firebird. import fdb from PDFWriter import PDFWriter con = fdb.connect(dsn='localhost:/temp/firebird/test.fdb', user='dummy', password='dummy') cur = con.cursor() select_stmt = 'select * from contacts order by name desc' cur.execute(select_stmt) pw = PDFWriter("contacts.pdf") pw.setFont("Courier", 12) pw.setHeader("Firebird RDBMS data (contacts.fdb) to PDF") pw.setFooter("Generated by xtopdf using fdb Firebird driver for Python") for (id, name, address) in cur: print id, name, address pw.writeLine(str(id) + " " + name + " " + address) pw.close() # EOF