Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Insert text into pdf templates

Project Description

Source Code: https://github.com/diafygi/pdfformfiller

Documentation: https://pdfformfiller.readthedocs.org/

This is a library that lets you easy insert text into a pdf. It is super useful when you need to prefill an existing pdf template (for example, a grant application form) with your own data.

pip install pdfformfiller

Once installed, you can add text fields to any pdf. You specify the bounding box of the field, and the text will auto-resize to fit within that rectangle.

from pdfformfiller import PdfFormFiller
filler = PdfFormFiller("myform.pdf")
filler.add_text(text, pagenum, (x1, y1), (x2, y2))
filler.write(outfile)

In order to determine the correct (x1, y1), (x2, y2) coordinates for your test field bounding box, we recommend dumping your existing pdf template to images with 72 dpi and using an image editor (like GIMP) to find the pixel coordinates of the rectangle you want your bounding box to be.

pdftoppm -png -r 72 myform.pdf myform-pages
Release History

Release History

This version
History Node

0.4

History Node

0.3

History Node

0.2

History Node

0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
PdfFormFiller-0.4.tar.gz (4.4 kB) Copy SHA256 Checksum SHA256 Source Mar 20, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting