PDFgenOverview
PDFgen is a pure Python library for generating PDF
documents. It lets you do just about anything with text,
vector graphics and images. I hope it will be useful for
- High-volume corporate reporting and database publishing
- Generating PDF on the fly on web sites - server applications could generate PDF output for print in the same way that
they generate HTML output for browsing
- Adding a 'print engine' to Python applications.
- Shipping a 'report language' with an application so that users
can customize their own reports
- Building a documentation system which indexes and archives output
- A 'build system' for complex documents such as management accounts,
statistical reports and scientific papers which need a lot of charts
PDF is the ideal output format for print - a universal previewer is
available and on most corporate desktops, along with a base set of fonts.
Rather than going direct to a printer, you get an electronic document
which can be previewed, archived and emailed.
Choice of Interfaces
There are two interfaces you can use to make PDF documents. Others may
happen in future - for example, something that behaves like a Tkinter canvas
but writes to PDF.
The most important one is the PIDDLE API.
PIDDLE stands for " Python Interactive Drawing, Does Little Else" it defines
a standard 'Canvas' interface, with multiple back ends for drawing on various
platforms. Currently these include Tkinter, Mac (Quickdraw), Postscript, PDF,
OpenGL, and the Python Imaging Library. Pythonwin and wxWindows are under
development. This lets you write and reuse (for example) chart code for
an application window, then do your printed reports by using PDFgen.
There is also a low-level API which offers more power and performance,
but is definitely not cross-platform. This is quite new and piddlePDF has
been implemented on top of it - read about it here.
This is available in the PIDDLE distribution in the module pdfgen.py.
Download and Setup
Users should be getting PIDDLE from the official site above. For co-developers,
I place my latest patches here.
The modules should be unzipped on your Python path. You can use the low level API
and run the script testpdfgen.py, which produces test output.
However, you need the full PIDDLE installation to use the high level API.
License
This release is under the Python license - fully Open Source. I believe
this is the best way to get the core stable. Many planned future features
will target the needs of corporates who can afford to pay, so I may offer
specialized commercial add-ons, C extensions or repackaging in future.
Goals
I hope to extend this to provide all of the features needed for a
serious corporate reporting system with no limits. This will take
some time, and needs some commercial partners or customers.
I am willing to implement new features on a commercial joint-development
basis.
Features Planned
As noted, the first goal is stability. I'm also eagerly awaiting the
GRAPHITE graphing package, which is based on PIDDLE and should give us
a superb graphing package. Other planned features include:
- Text handling tools - justification and wrapping algorithms. These
could be done in PIDDLE version 2.0
- Asian language support - Acrobat 4.0 and PDF 1.3 give the first decent
solution for portable Asian-language support. PDFgen will let me write
the correct language-specific paragraph wrapping rules - for example,
Ken Lunde's text-wrapping rules for Japanese. A system for managing
user-defined characters in any encoding is also planned.
- Expanded graphics - PIDDLE is a lowest-common-denominator API. In addition
I would like to add coordinate transforms and path operations for those who
need them
- a Page Layout API to handle 'flow objects' built on top of PDFgen and PIDDLE.
This will reduce the code users need to write and allow us to build hierarchies
of reusable 'drawable objects' such as tables, charts and frames.
- Better support for PDF features - tables of contents, hot links, page
transition effects
Robinson Analytics Ltd., Wimbledon, London. email
mailto:andy@robanal.demon.co.uk