Skip to content

PDFCLOUD-6571 Add ZUGFeRD PDF creation - #57

Open
datalogics-tsmith wants to merge 4 commits into
mainfrom
pdfcloud-6571-add-zugferd-pdf-creation
Open

datalogics-tsmith wants to merge 4 commits into
mainfrom
pdfcloud-6571-add-zugferd-pdf-creation

Conversation

@datalogics-tsmith

Copy link
Copy Markdown
Contributor

PDFCLOUD-6571

Dependency: This PR is stacked on #55 and must not be merged until #55 has merged. The branch includes the current #55 commits so CI can run from the main pdfrest repository.

Why this change

The Python SDK does not expose pdfRest's ZUGFeRD PDF operation, so callers cannot use the typed clients to turn CII invoice XML into a validated ZUGFeRD or Factur-X PDF/A-3 invoice. This adds that workflow to both supported client transports.

What changed (high level)

New synchronous and asynchronous create_zugferd_pdf helpers accept uploaded invoice XML plus optional PDF and logo resources. A dedicated Pydantic payload model owns resource validation and wire serialization, while public render-option types make appearance, localization, colors, fonts, and numeric constraints discoverable to callers.

The change also adds focused unit and live coverage, a deterministic minimum-profile invoice fixture, public API documentation, and a standalone runnable example.

Behavior changes

Callers can create a new visual invoice from CII XML, preserve a supplied PDF when it matches the invoice, or permit regeneration when the supplied PDF cannot be confirmed. Rendering supports logo placement, installed text-capable fonts, RGB or CMYK colors, footer text, locale and label-language selection, currency display, date formatting, decimal precision, and an output prefix.

Invalid MIME types, multiple resources where only one is allowed, unsupported option values, malformed colors, unsafe output prefixes, and inconsistent regeneration inputs fail locally before transport. The API is additive and does not change existing helpers.

Validation

On the final stacked branch, all 308 focused PDF-to-PostScript and ZUGFeRD unit tests passed. The complete non-live suite passed with 3,231 tests and 10 expected skips, and the full pre-commit suite passed, including Ruff formatting/linting and basedpyright.

The ZUGFeRD route was also exercised through 12 live sync and async cases covering all closed render-option literals, mismatched-PDF regeneration, response metadata, and server-side invalid-option rejection. The Python 3.10-3.14 Nox test matrix passed before the final dependency sync; the sync only incorporated the current #55 review-fix commit.

Risks and follow-ups

Merge #55 first, then update this branch against main before merging so the final diff contains only the ZUGFeRD work. Font availability remains deployment-specific; the published font names are discoverable suggestions while the public type continues to accept other installed text-capable fonts. CI on the main repository provides the final clean-environment and interpreter-matrix verification.

@netlify

netlify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for pdfrest-python ready!

Name Link
🔨 Latest commit 7d951b6
🔍 Latest deploy log https://app.netlify.com/projects/pdfrest-python/deploys/6ada33dd7c9db380f1b26c29
😎 Deploy Preview https://deploy-preview-57--pdfrest-python.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

- Add typed rendering options for invoice appearance and localization.
- Validate uploaded resources, color channels, fonts, and regeneration.
- Serialize the public input shape into the pdfRest wire contract.

Assisted-by: Codex
- Add synchronous and asynchronous helpers for uploaded invoice XML.
- Support optional PDFs, logos, rendering controls, and request options.
- Cover serialization, validation, response mapping, and both transports.

Assisted-by: Codex
- Exercise every closed rendering option through both client transports.
- Verify regenerated PDFs, response metadata, and server-side rejection.
- Add a deterministic minimum-profile invoice fixture.

Assisted-by: Codex
- Add a standalone typed example with a deterministic invoice fixture.
- Verify the generated PDF and print useful response metadata.
- Link the helper from the API guide and example inventories.

Assisted-by: Codex

This branch was previously deployed

1 inactive deployment
ci-live — 7d951b62 Deployed Oct 22, 2026 by datalogics-tsmith via Examples (Python 3.12) #585
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants