Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate a pdf with python

Tags:

python

pdf

latex

I'm trying to develop a small script that generate a complete new pdf, mainly text and tables, file as result. I'm searching for the best way to do it.

I've read about reportlab, which seems pretty good. It has only one drawback asfar as I can see. It is quiet hard to write a template without the commercial version, and the code seems to be hard to maintain.

So I've searched for a more sufficient way and found xhtml2pdf, but this software is quiet old, and cannot generate tables over two pages or more.

The last solution in my mind it to generate a tex-File with a template framework, and later call pdftex as subprocess.

I would implement the last one, and go over LateX. Would you do so, have you better ideas?

like image 409
Johannes Avatar asked Jul 30 '12 16:07

Johannes


2 Answers

I would suggest using the LaTeX approach. It is cross-platform, works in many different languages and is easy to maintain. Plus it's non-commercial!

like image 57
Amado Levey Avatar answered Sep 28 '22 08:09

Amado Levey


Pisa is a Html/CSS to PDF converter. It's a great tool for developing Pdf's from scratch using python.

If you need to just append Pdf Pages together, or search through Pdf data, then I'd suggest pyPdf it is free and pretty well documented and easy to use. You can download it here

like image 24
Branden S. Smith Avatar answered Sep 28 '22 09:09

Branden S. Smith