A customizable PDF signature box generator
Project description
PDF Signer
A customizable Python package for adding signature boxes to PDF documents based on text tags.
Features
- Add signature boxes to PDFs at positions marked by customizable tags
- Highly configurable appearance of signature boxes (colors, sizes, borders)
- Customizable text content and layout in signature boxes
- Support for verification images/badges
- Flexible tag pattern matching
Installation
pip install pdf-signer
Basic Usage
from pdf_signer import PDFSigner
# Create a signer with default settings
signer = PDFSigner()
# Define signature data
signature_values = {
"int_p1": {
"name": "John Doe",
"Date": "14.03.25 at 10:30:45 AM",
"tick_image_path": "path/to/bluetick.png",
"IP": "192.168.1.1",
}
}
# Process the PDF
success, count, found_tags = signer.fill_signature_fields(
"input.pdf", "output.pdf", signature_values
)
print(f"Found tags: {found_tags}")
print(f"Processed {count} signature fields")
Advanced Configuration
You can customize almost every aspect of the signature boxes:
from pdf_signer import PDFSigner, SignerConfig, SignatureBoxStyle
# Create custom style
custom_style = SignatureBoxStyle(
box_width=40,
box_height=35,
background_color=(0.9, 0.9, 1.0), # Light purple
border_color=(0.5, 0.0, 0.5), # Purple
border_style="dashed",
row_data=["name", "Signed:", "Date", "IP: ", "IP"]
)
# Create configuration with custom tag pattern
config = SignerConfig(
tag_pattern_str=r"signature_([a-z]+)", # Custom tag pattern
default_style=custom_style
)
# Create signer with custom config
signer = PDFSigner(config)
Customizing Tags
By default, the package looks for tags like int_p1 or count_p1, but you can define any pattern:
config = SignerConfig(
tag_pattern_str=r"(?P<type>sign|approve|review)_(?P<id>\d+)"
)
Different Styles for Different Tags
You can define different styles for different types of signature boxes:
config = SignerConfig(
tag_pattern_str=r"(ceo|manager|staff)_(\d+)",
style_overrides={
"ceo": SignatureBoxStyle(
background_color=(1.0, 0.9, 0.9), # Light red
row_data=["name", "CEO Approval", "Date"]
),
"manager": SignatureBoxStyle(
background_color=(0.9, 1.0, 0.9), # Light green
row_data=["name", "Manager Approval", "Date"]
)
}
)
License
MIT
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdf_signer-0.1.3.tar.gz.
File metadata
- Download URL: pdf_signer-0.1.3.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bbf406604c4aa1a8c23fb572e76e63eb2a0a7594f851a421ef1608f7c9d1db9
|
|
| MD5 |
24c8d3e4370ec313472e59dfda1f3592
|
|
| BLAKE2b-256 |
cea1d8789cb3a178b4a8b1ed436a77b788eb063fca049bf5ce5761e4757bc840
|
File details
Details for the file pdf_signer-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pdf_signer-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4026b6b540e4a20b59645db4c3e6a36bf8ea32ced4c8d3397d6329664f94f6a4
|
|
| MD5 |
9d32cb0dea1ae4d2ba761a79e6025249
|
|
| BLAKE2b-256 |
714e4d803f7d52c52e45ae57236cad6ebcf47dad18f87a0bea20b72b2141428b
|