[[TOC]] = !BluePrint: PDF Generation = This page is a collection of notes on PDF generation that were previously scatter around a number of other pages. == !ReportLab == For more formal reports (which can also be retrieved via webservices using the PDF representation of the REST Controller), we currently use [http://reportlab.org ReportLab]. This also supports Graphics (via [http://www.pythonware.com/products/pil/ PIL]) === How to set up a new PDF file === You need to edit your pdf-defs.tcl file to include the new type in pdf_generate_pdf. Also create a new pdf-xxx.py Python file, and set it up as you like it. That's basically it. * http://www.reportlab.com/software/opensource/ * http://www.reportlab.com/software/opensource/rl-toolkit/ (open source version) == OCR == * BluePrintOCR * [wiki:BluePrint/OCRIntegration] * [wiki:UserGuidelines/OCR] == PDF Tasks == ''From Haiti Response - are these still current?'' * Fix the base PDF generation in {{{models/01_RESTlike_controller.py}}}'s {{{export_pdf()}}} as they currently look awful (& hence aren't exposed to users by hiding it in {{{views/formats.html}}})! * /module/resource.pdf * Provide a Filter option exposed to users so they can print just the Contacts for a particular Organisation * Ideally a generic routine, but then a [wiki:RESTController#Options custom one can be added] via {{{response.s3.formats.pdf}}} variable being set in the Controller before invoking the {{{shn_rest_controller()}}} to make it really pretty See: * https://bugs.launchpad.net/sahana/+bug/508654 * "generate a contact list for specific orgs as a PDF" * [wiki:BluePrint/Reporting Data Analysis, Visualisation and Reporting] * We currently use Geraldo for PDF creation, but it has issues, so we should consider either switching to Pisa or dropping down to raw ReportLab (with our own custom classes on top). * We do this already for the OCR PDF generation. === Other Tools === * [http://www.xhtml2pdf.com Pisa] uses [http://reportlab.org ReportLab] to generate PDF from HTML * [http://code.google.com/p/jspdf jsPDF] uses pure !JavaScript to create PDFs * [http://geraldo.sourceforge.net Geraldo] builds on !ReportLab, and we used to use this, but no longer * Use S3XRC & hence XSLT to generate XML-FO which can be converted to PDF * http://xmlgraphics.apache.org/fop/ * http://pypi.python.org/pypi/zopyx.convert/ * [http://osdir.com/ml/python.reportlab.user/2003-10/msg00206.html Recommend ReportLab over FOP] ---- BluePrints