top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

PDF generator in python

+1 vote
290 views

This questions may be asked several times already, but the development of relevant software continues day-for-day. For some time now I've been using xhtml2pdf ( https://github.com/chrisglass/xhtml2pdf ) to generate PDF documents from HTML templates (which are rendered through my Django-based web application. This have been working for some time now but I'm constantly adding new templates and they are not looking like I want it (sometimes bold text is bold, sometimes not, layout issues, etc). I'd like to use something else than xhtml2pdf.

So far I'd like to ask which is the (probably) best way to create PDFs in Python? It is important for me that I am able to specify not only background graphics, paragaphs, tables and so on but also to specify page headers/footers. The reason is that I have a bunch of documents to be generated (including Invoice templates, Quotes - stuff like that).

posted May 14, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

Reportlab works well in Python 2.x. Their _next_ version is supposed to work with Python3.

answer May 14, 2013 by anonymous
0 votes

1) Use Python to collect your data (db, pictures, texts, ...) and/or to create the material (text, graphics, ...) that will be the contents (source) of your your pdf's.
2) Put this source in .tex file (a plain text file).
3) Let it compile with a TeX engine.

  • I can not figure out something more versatile and basically simple (writing a text file).
  • Do not forget you are the only one who knows the content and the layout of your document(s).
answer May 14, 2013 by anonymous
Similar Questions
0 votes

I'm looking into a good versatile PDF generator class/library to use with PHP 5? --- Preferably one which is maintained somewhat recently...

Mostly needed for basic pages, but I also have some longer reports (more than one 8.5" x 11" page) and it would be nice if the pdf was able to split it up without losing part of the font when crossing page boundaries etc...

...