Skip to main content

pdf_template

Small wrapper around pdftk for filling and signing PDFs

Example:

from pdf_template import PDFTemplate, PDFTemplateSection, SignatureBoundingBox
from PIL import Image

input_data = {
    "is_18_or_over": True,
    "title_mr": False,
    "title_ms": True,
    "first_name": "Foo",
    "last_name": "Bar",
    "address1": "None",
    "zipcode": None,
    "mailto_line_1": "some address!",
}

template = PDFTemplate(
    [
        PDFTemplateSection(path="tests/test-input-page-1.pdf", is_form=True),
        PDFTemplateSection(
            path="tests/test-input-page-2-3.pdf",
            is_form=True,
            signature_locations={
                1: SignatureBoundingBox(x=300, y=490, width=200, height=37)
            },
        ),
        PDFTemplateSection(
            path="tests/test-input-page-4.pdf",
            signature_locations={
                1: SignatureBoundingBox(x=188, y=50, width=200, height=28)
            },
        ),
    ]
)

with template.fill(
    input_data, signature=Image.open("tests/sig.jpeg")
) as output_pdf:
    with open("output.pdf", "wb") as out_file:
        out_file.write(output_pdf.read())

Metadata

Release files for pdf-template 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdf-template 0.0.2
File Size Uploaded
pdf_template-0.0.2.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pdf-template 0.0.2
File Interpreter ABI Platform
pdf_template-0.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.5 kB

Release files / pdf_template-0.0.2.tar.gz

Download URL pdf_template-0.0.2.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7e108ffabdd99e126d8ec3914e19c45b79c38df383471231ecdf0e093b936ab3
BLAKE2b-256 checksum
How to use checksums
8fe750c71773d7f59a6c5f1e972999b246d5a41e3657c7d0a2a62e99dfbc4a2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / pdf_template-0.0.2-py2.py3-none-any.whl

Download URL pdf_template-0.0.2-py2.py3-none-any.whl
Size 7.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
028913e0dbd394511b5a843f4dab8dfb971dd8a8193a711d7ebc722e62020c61
BLAKE2b-256 checksum
How to use checksums
f2c5e8c22c7b53c7c13b7389ce813639fc1680f60a89e48ee244267639c835ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page