Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pure python solution to convert XHTML to PDF

I am after a pure Python solution (for the GAE) to convert webpages to pdf.

I had a look at reportlab but the documentation focuses on generating pdfs from scratch, rather than converting from HTML.

What do you recommend? - pisa?

Edit: My use case is I have a HTML report that I want to make available in PDF too. I will make updates to this report structure so I don't want to maintain a separate PDF version, but (hopefully) convert automatically.
Also because I generate the report HTML I can ensure it is well formed XHTML to make the PDF conversion easier.

like image 570
hoju Avatar asked Oct 21 '09 04:10

hoju


1 Answers

Pisa claims to support what I want to do:

pisa is a html2pdf converter using the ReportLab Toolkit, the HTML5lib and pyPdf. It supports HTML 5 and CSS 2.1 (and some of CSS 3). It is completely written in pure Python so it is platform independent. The main benefit of this tool that a user with Web skills like HTML and CSS is able to generate PDF templates very quickly without learning new technologies. Easy integration into Python frameworks like CherryPy, KID Templating, TurboGears, Django, Zope, Plone, Google AppEngine (GAE) etc.

So I will investigate it further

like image 180
hoju Avatar answered Sep 18 '22 09:09

hoju