Skip to main content

uploadkit-pdf

CI Coverage Python

PDF validators, policies, and metadata for UploadKit.

What problem does this solve?

PDF-specific structure, security, and page-limit checks that plug into UploadPolicy.validators without modifying UploadKit Core.

When to use it

Use when uploads must accept PDFs safely (no JavaScript, embeds, or encryption by default).

When not to use it

  • Do not render, edit, merge, or OCR PDFs here.
  • Do not put generic MIME/filename checks here (see uploadkit-security).

Installation

Requires Python 3.10+.

pip install uploadkit-pdf

Quick Start

from uploadkit import Uploader
from uploadkit_pdf import PdfPolicy

uploader = Uploader(PdfPolicy(max_size=5 * 1024 * 1024, max_pages=50), storage=my_storage)

Customize validators

from uploadkit import UploadPolicy
from uploadkit_pdf import default_pdf_validators, PdfPageLimitValidator

policy = UploadPolicy(
    allowed_extensions=frozenset({"pdf"}),
    allowed_mime_types=frozenset({"application/pdf"}),
    validators=default_pdf_validators(max_pages=20, exclude=PdfPageLimitValidator),
)

Inspect metadata

from uploadkit_pdf import inspect_pdf

meta = inspect_pdf(open("doc.pdf", "rb").read())
print(meta.page_count, meta.encrypted, meta.has_javascript)

Public API

Symbol Kind
PdfPolicy Public
PdfMetadata / inspect_pdf Public
PdfStructureValidator Public
PdfSecurityValidator Public
PdfPageLimitValidator Public
default_pdf_validators Public
AsyncPdfStructureValidator Public
AsyncPdfSecurityValidator Public
AsyncPdfPageLimitValidator Public
default_async_pdf_validators Public

Coverage

The coverage badge is a measured total from coverage report --include='src/*', not an aspirational 100%. CI enforces --fail-under=80.

Most of the gap is defensive and format-variant code in metadata.py (malformed PDFs, annotation/JS/embed edge cases). Validators and policies are largely covered. Unlike Core / framework adapters, this package does not claim 100% yet — fixtures for those branches are welcome.

Changelog

See CHANGELOG.md.

Contributing

See CONTRIBUTING.md.

Metadata

Release files for uploadkit-pdf 0.1.1

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

Source distribution (sdist)

Source distribution for uploadkit-pdf 0.1.1
File Size Uploaded Provenance
uploadkit_pdf-0.1.1.tar.gz 12.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for uploadkit-pdf 0.1.1
File Interpreter ABI Platform
uploadkit_pdf-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.9 kB

Release files / uploadkit_pdf-0.1.1.tar.gz

Download URL uploadkit_pdf-0.1.1.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
25cd159b22fa2ef37d3a9967dadc248dc7c7cad6ce00ba328b639207f515f4a5
BLAKE2b-256 checksum
How to use checksums
4090dcec12cf34431426df1362c598dfc8845f6d0602529008505ecea8fafc2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / uploadkit_pdf-0.1.1-py3-none-any.whl

Download URL uploadkit_pdf-0.1.1-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe29eab3a17c65f5d587c3d8de09417d377c7ab6c380a07f6f963da1d38bdfaa
BLAKE2b-256 checksum
How to use checksums
e6fdef5ed86036e9dc43401f204a20be89dfdb6e217c790177d0e76d26e2afce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for uploadkit-pdf 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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