6
votes

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?

3
the free version of report lab works pretty decently imho... as long as you arent trying to do anything too difficultJoran Beasley
yeah it would work, but the method for generating something simple are so complex and kind of "lowlevel". And after two weeks I would not see any clou what the code does or anybody who does not write reportlab on regular basis. Anyway thanks fot your help.Johannes
appyframework.org/pod.html looks quite interesting although I haven't tried it myself. From my own experience I would say that ReportLab is worth sticking with - you might be as well giving it a go and then posting new questions when you get stuck.George
Thanks for your, answer George. pod, I don't know, first I need to run a subprocess with OpenOffice (Java) in my opinion to much overhead for something simple, second the template creation goes over WYSIWYG. I think this is a bottleneck in maintaining and debugging the pdf.Johannes

3 Answers

5
votes

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!

3
votes

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

0
votes

You may check the http://pypi.python.org/pypi/z3c.rml/ package as an implemenation of Reportlab's RML.

"best way" means? What are you requirements? Some PDF requirements can be accomplished with "cheap" open-source generators or you may end up with some commercial PDF converter. Higher quality means higher price.