Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Add a grid on top of all pages of a PDF document.

Project description

Pdfgrid is a Python command-line tool and module for adding a regular grid on top of all pages of an existing PDF document. It will mostly be used for measuring individual parts of PDF pages like graphics or paragraph widths. For the time being, only a rectangular grid with major and minor lines is supported, and their colour and line widths can be set individually.

NOTE: This is an initial release. The API is likely to change and for the time being the grid size is limited to A4, but this will change in future releases.

Pdfgrid depends on two Open Source libraries, namely pyPdf, a package written by Mathieu Fenniak and reportlab by ReportLab, Ltd.

This version fixes an issue with the manual installation.


  • add regular rectangular grid over all pages of a PDF document
  • define grid origin on all PDF pages
  • define grid styles containing grid step, line width and colour
  • use multiple grids at once with different styling
  • install a Python module named
  • install a Python command-line script named pdfgrid
  • provide a Unittest test suite


You can use pdfgrid as a Python module e.g. like in the following interactive Python session:

>>> from reportlab.lib.colors import red
>>> from reportlab.lib.units import cm
>>> from pdfgrid import grid
>>> grid("foo.pdf", origin=(0, 0), styles=[(1*cm, 0.1, red)])
written: foo-grid.pdf

In addition there is a script named pdfscript, which can be used from the system command-line e.g. like this:

$ pdfgrid -h
$ pdfgrid -v
$ pdfgrid --origin "0,0" --styles "1*cm,0.1," foo.pdf
written: foo-grid.pdf

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pdfgrid, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size pdfgrid-0.2.0-py2.5.egg (7.7 kB) File type Egg Python version 2.5 Upload date Hashes View
Filename, size pdfgrid-0.2.0-py2.6.egg (7.7 kB) File type Egg Python version 2.6 Upload date Hashes View
Filename, size pdfgrid-0.2.0.tar.gz (38.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page