Jinja-like for Pdf in Python

Viewed 16374

I am looking for the best accurate tool for PDF in Python that works like Jinja does for HTML.

What are your suggestions?

8 Answers

As answered by jbochi, ReportLab is the foundation for almost all Python projects that generate PDF.

But for your needs you might want to check out Pisa / xhtml2pdf. You would generate your HTML with a Jinja template and then use Pisa to convert the HTML to PDF. Pisa is built on top of ReportLab.

Edit: another option I'd forgotten about is wkhtmltopdf

Have a look at ReportLab Toolkit.

You can use templates only with the commercial version, though.

... There is also the library pdfjinja that is for this purpose: https://github.com/rammie/pdfjinja

It is using annotations to create template values.

In my use case, I didn't have a PDF with proper form fields so the solution suggested by cchantep was more suitable.

Related