6

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?

6
  • the free version of report lab works pretty decently imho... as long as you arent trying to do anything too difficult Commented Jul 30, 2012 at 16:31
  • 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. Commented Jul 30, 2012 at 16:47
  • 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. Commented Jul 30, 2012 at 17:03
  • 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. Commented Jul 30, 2012 at 20:40
  • Also see Is there a better layout language than HTML for printing? Commented Jul 31, 2012 at 5:54

3 Answers 3

6

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!

Sign up to request clarification or add additional context in comments.

3 Comments

LaTeX does suit all PDF requirements. Complex layout oriented PDFs are not doable with LaTeX...just the wrong tool in this case...the right tool for each project...
@Maulwurfn LaTeX with TikZ is perfect for complex pdf layouts...
Thanks Zenon, TikZ looks wonderful. I will implement it with jinja2 for parsing LateX-Template and call a subprocess of pdftex for pdf creation.
4

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

3 Comments

Sorry, I can't see how this framework is capable of generating a new pdf from scratch. Thanks for your answer.
Oh my bad I misunderstood the question. Yeah then I would suggest using "pisa" for generating PDF's from scratch. Pisa can convert html/css to a pdf so it makes it quite easy to stylize your pdf. pyPdf is great if you need to append Pdf's or extract data from them.
Pisa is a piece of fragile crap - Suitable for producing cheap PDFs - completely useless for professional usage.
0

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.

1 Comment

Thanks for your answer."Best way" means how would the guys with more expertise in this area would do it. Requirements are quite simple, a lightweight easy to maintain way to generate a pdf with text and tables where tables could go over n pages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.