Skip to main content

pdf2pdfa

CI PyPI

Convert ordinary PDF documents into fully compliant PDF/A files (1b, 2b, 3b).

Installation

pip install pdf2pdfa

Requires Python 3.9+.

CLI Usage

Single file

pdf2pdfa convert input.pdf output.pdf

Choose PDF/A level

pdf2pdfa convert input.pdf output.pdf --level 2b
pdf2pdfa batch *.pdf --level 3b

Supported levels: 1b (default), 2b, 3b.

Batch conversion

pdf2pdfa batch *.pdf

Options

Flag Description
--level LEVEL PDF/A conformance level: 1b, 2b, 3b (default: 1b)
--icc PATH Custom ICC profile
--font PATH Custom TrueType font for embedding
--validate Run verapdf validation after conversion
-v, --verbose Enable debug logging

Python API

from pdf2pdfa import Converter

conv = Converter()                    # PDF/A-1b (default)
conv.convert("input.pdf", "output.pdf")

conv = Converter(level="2b")          # PDF/A-2b
conv.convert("input.pdf", "output_2b.pdf")

What it does

  • Smart font matching: resolves each PDF font to the best system substitute by family (serif/sans/mono), weight (bold/normal), and style (italic/roman)
  • Embeds missing fonts with correct WinAnsiEncoding width metrics
  • Attaches sRGB ICC profile with proper /N on the stream dictionary
  • Replaces DeviceRGB/DeviceCMYK color spaces with ICC-based equivalents
  • Sets PDF/A conformance in XMP metadata (1b, 2b, or 3b)
  • Synchronizes XMP and document info dictionary

v3.1.0 Highlights

  • New: Multi-level PDF/A support — --level 1b (default), --level 2b, --level 3b
  • Python API: Converter(level="2b")
  • OutputIntent /S correctly uses /GTS_PDFA1 for all PDF/A levels per ISO 19005

v3.0.0 Highlights

  • New: Font matching system — each unembedded font is resolved individually instead of using a single fallback
    • Times-Roman → times.ttf (serif), Courier → cour.ttf (mono), Helvetica → arial.ttf (sans)
    • Bold, italic, and bold-italic variants are matched to the correct system font files
    • Graceful degradation: if an exact match isn't found, falls back through style → weight → category
    • Cross-platform support: Windows, macOS, and Linux font paths
    • --font flag still works as a user override for all fonts
  • Refactored: converter.py no longer contains platform-specific font search logic

v2.0.0 Highlights

  • Fixed: ICC profile /N entry now correctly placed on stream dictionary (verapdf validation pass)
  • Fixed: Font glyph width mismatch for WinAnsiEncoding codes 128-159
  • Fixed: DeviceCMYK images now properly covered by CMYK OutputIntent
  • New: batch command for multi-file conversion
  • New: --validate flag for post-conversion verapdf check
  • New: --font flag for custom font embedding
  • Removed: reportlab dependency (no longer needed)
  • Removed: Python 3.7/3.8 support (minimum 3.9)

Development

git clone https://github.com/nks1990/pdf2pdfa.git
cd pdf2pdfa
pip install -e .[test]
pytest -v

License

MIT - see LICENSE.

Metadata

Release files for pdf2pdfa 3.1.0

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

Source distribution (sdist)

Source distribution for pdf2pdfa 3.1.0
File Size Uploaded
pdf2pdfa-3.1.0.tar.gz 25.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pdf2pdfa 3.1.0
File Interpreter ABI Platform
pdf2pdfa-3.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 46.6 kB

Release files / pdf2pdfa-3.1.0.tar.gz

Download URL pdf2pdfa-3.1.0.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d4111d5e729d2b75d1eb29988e1cc9e4d33cc9e6d41934643da7f743065a3103
BLAKE2b-256 checksum
How to use checksums
8eae7753fa6dc755ff275af0fc1a60fca691b67a2d336554fe44cfbf65772bc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 1, 2026.

Transparency log

Release files / pdf2pdfa-3.1.0-py3-none-any.whl

Download URL pdf2pdfa-3.1.0-py3-none-any.whl
Size 21.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76df8dfeea1fce7e8f41dd1f4ce798b3e58c8e8f31eee0a2d238f40408918a42
BLAKE2b-256 checksum
How to use checksums
36ec41e0efb29de5992de6bfa21632a0cc30accfcc1d03afc02a3bb4fa255eaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.1.0 This release

2 release files

0.1.0

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