The Python library for PDF forms.
Project description
Introduction
PyPDFForm is a free and open source pure-Python 3 library for PDF form processing. It contains the essential functionalities needed to interact with PDF forms:
- Inspect what data a PDF form needs to be filled with.
- Fill a PDF form by simply creating a Python dictionary.
- Create a subset of form widgets on a PDF.
It also supports other common utilities such as extracting pages and merging multiple PDFs together.
Installing
Install using pip:
pip install PyPDFForm
Quick Example
A sample PDF form can be found here. Download it and try:
from PyPDFForm import PdfWrapper
filled = PdfWrapper("sample_template.pdf").fill(
{
"test": "test_1",
"check": True,
"test_2": "test_2",
"check_2": False,
"test_3": "test_3",
"check_3": True,
},
)
with open("output.pdf", "wb+") as output:
output.write(filled.read())
After running the above code snippet you can find output.pdf
at the location you specified,
and it should look like this.
Documentation
The official documentation can be found on the GitHub page of this repository.
Public Speak
Chicago Python User Group - Dec 14, 2023
How to Contribute
It is difficult to make sure that the library supports all the PDF form creating tools out there. So if you run into a case where the library does not work for certain PDF forms created by certain tools, feel free to open an issue with the problematic PDF form attached. I will seek to make the library support the attached PDF form as well as the tool used to create it.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for PyPDFForm-1.4.28-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f53f40f4a68221ce78fd55e354ce4022e93a080cc49fc173d6819840a0b348b5 |
|
MD5 | e2ace28bb70ca25f5b98cb633c8170f5 |
|
BLAKE2b-256 | 029d94ebebd12f40ed7ea3b9ddd4b252fd37d270fe53430f216612f9612caf58 |