Home arrow Python arrow Python for PDF Generation

Python for PDF Generation

The Portable Document Format (PDF) lets you create documents that look exactly the same on every platform. Sometimes a PDF document needs to be generated dynamically, however, and that can be quite a challenge. Fortunately, there are libraries that can help. This article examines one of those for Python.

  1. Python for PDF Generation
  2. Putting Virtual Ink to Virtual Paper
  3. Text Formatting Techniques
  4. Using Graphics
By: Peyton McCullough
Rating: starstarstarstarstar / 64
March 14, 2006

print this article



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:


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):


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.

>>> More Python Articles          >>> More By Peyton McCullough

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- Tuples and Other Python Object Types
- The Dictionary Python Object Type
- String and List Python Object Types
- Introducing Python Object Types
- Mobile Programming using PyS60: Advanced UI ...
- Nested Functions in Python
- Python Parameters, Functions and Arguments
- Python Statements and Functions
- Statements and Iterators in Python

Developer Shed Affiliates


Dev Shed Tutorial Topics: