Ok when im gonna make reports with Java I use iReport for JasperReports Template designs.
But with python the alternative is html2pdf - pisa.
It would be great to see an example of this. Any hint would be appreciated. Tks.
Ok when im gonna make reports with Java I use iReport for JasperReports Template designs.
But with python the alternative is html2pdf - pisa.
It would be great to see an example of this. Any hint would be appreciated. Tks.
The accounting software we are developing uses pisa to generate pdf reports. The process is like this:
StringIO
object to store the pdf and send its content via HttpResponse.HttpResponse
object should be set to application/pdf
and use Content-Disposition
header if you want to trigger download instead of displaying in the browser.Pisa uses some unique CSS properties to specify pdf related formatting (page-size, page-break etc). Their docs provide sufficient examples on this.
Pisa's rendering of HTML/CSS can be quite a bit different from what we usually see in browser. For example, setting border="1"
on a <table>
will give all cells of the table border, borders are always collapsed (border-collapse css attribute has no effect) etc.
And yes, http://www.xhtml2pdf.com comes with a djangoproject example :)
This is written by me, but answers the exact same questions, so linking it here. http://uswaretech.com/blog/2008/10/generating-pdfs-with-django/