The aim of the Portable Document Format is noble. Every page should look exactly the same on any platform, regardless of user settings. If a user were to view a certain web page on my computer and then switch the resolution, the change could be quite significant. Likewise, if a user viewed a web page or some other sort of document on Windows and then switched to Linux, things might also look very different. This is fine for a lot of things, but when pages need to be formatted in a precise way, as in books or user manuals, it becomes a problem. It is, however, a problem that can easily be solved by creating PDF documents for things like these. PDF documents are fairly easy to create today. All someone has to do is click a button or a menu option in his favorite word processing application, or he can simply print a page to a PDF file. However, there are certain situations where this cannot be done, such as when a PDF document needs to be generated dynamically. This is where programming comes in. There are a number of libraries designed to work with a number of languages to generate PDF documents. This article will examine the ReportLab Toolkit for Python. Obtaining the ReportLab Toolkit The ReportLab Toolkit may be obtained from the ReportLab website: http://www.reportlab.org/downloads.html Extract the archive and then run the install script: $ python setup.py install If you plan on working with images, you'll also need the Python Imaging Library (PIL): http://www.pythonware.com/products/pil If you're on Windows, just download and run the binary installer. Otherwise, download the source, extract it and run the installation script: $ python setup.py install Again, you'll need the proper permissions.
blog comments powered by Disqus |