Skip to content

PDFCLOUD-6576 Add tagged-text options - #62

Draft
datalogics-tsmith wants to merge 3 commits into
pdfcloud-6575-add-pdf-page-box-updatesfrom
pdfcloud-6576-add-tagged-text-options
Draft

datalogics-tsmith wants to merge 3 commits into
pdfcloud-6575-add-pdf-page-box-updatesfrom
pdfcloud-6576-add-tagged-text-options

Conversation

@datalogics-tsmith

Copy link
Copy Markdown
Contributor

PDFCLOUD-6576

Dependencies: This draft PR is stacked on #61, which is stacked on #60, #58, and #57. Merge those pull requests first, then update this branch onto main before making it ready for final review. The branch is hosted in the main pdfrest/pdfrest-python repository so GitHub Actions can run with the repository's CI configuration and secrets.

Why this change

The Python SDK's text-overlay helper does not expose pdfRest's documented tagging controls. Callers therefore cannot enable accessibility tagging for newly added text or identify its natural language without constructing raw requests.

What changed (high level)

The synchronous and asynchronous add_text_to_pdf helpers now accept optional tag_enabled and tag_language arguments. The existing payload model owns language syntax and dependency validation, preserving the thin-client design and leaving language-tag canonicalization to the service.

Focused unit and live coverage exercise both transports, exact request serialization, compatibility when the options are omitted, invalid combinations, and server-observable tagged output. A standalone typed example and API guidance make the workflow discoverable.

Behavior changes

Callers can set tag_enabled=True to tag newly added text and optionally provide a supported BCP 47 language form such as en-US. Supplying a language without explicitly enabling tagging fails locally before transport. Explicit None values and omitted options are excluded from the request, so existing callers retain their prior wire behavior.

The SDK validates the service-supported lexical shape—two or three language letters with at most one script or region subtag—and preserves accepted input for server-side canonicalization. The change is additive and does not intentionally break existing callers.

Validation

The focused unit module passed 37 tests. The complete credential-independent suite passed with 3,415 tests and 10 expected skips. The Python 3.10-3.14 Nox matrix passed with the same results and 96% overall coverage on each interpreter, and the client class-function coverage gate passed at its 90% threshold.

Ruff formatting and linting, basedpyright, changed-file pre-commit hooks, strict MkDocs validation, and git diff --check passed. Credentialed live tests and the standalone example were not completed locally because PDFREST_API_KEY was unavailable; main-repository CI provides the required live-service and example validation.

Risks and follow-ups

This PR must remain draft until #57, #58, #60, and #61 merge. Afterward, update the branch and PR base to main, resolve any stack conflicts, and rerun the full CI matrix before final review.

Language canonicalization remains service-owned. The SDK intentionally validates the service-supported request shape without attempting to reproduce deployment-specific canonicalization locally.

- Expose optional tagging and language settings on both client transports.
- Validate service-compatible language tags and their tagging dependency.
- Preserve existing request bodies when the new options are omitted.

Assisted-by: Codex
- Assert exact sync and async serialization for provided and omitted options.
- Cover language syntax, explicit nulls, and request-level dependencies.
- Verify live outputs report tagged document content through both clients.

Assisted-by: Codex
- Add a standalone typed example for tagged English text overlays.
- List the workflow in the runnable example inventory.
- Document tagging and natural-language metadata in the API guide.

Assisted-by: Codex

This branch was previously deployed

1 inactive deployment
ci-live — aedbed7b Deployed Nov 5, 2026 by datalogics-tsmith via Examples (Python 3.11) #607
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.

1 participant