Skip to content

PDFCLOUD-6577 Expand image overlay options - #63

Draft
datalogics-tsmith wants to merge 3 commits into
pdfcloud-6576-add-tagged-text-optionsfrom
pdfcloud-6577-expand-image-overlay-options
Draft

datalogics-tsmith wants to merge 3 commits into
pdfcloud-6576-add-tagged-text-optionsfrom
pdfcloud-6577-expand-image-overlay-options

Conversation

@datalogics-tsmith

@datalogics-tsmith datalogics-tsmith commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

PDFCLOUD-6577

Why this change

The image-overlay service supports sizing, repeated or multiple image placements, and accessibility metadata, but the Python client only exposed a single basic placement. Users need a typed way to use the full service contract while catching invalid file formats, page selectors, dimensions, and tagging combinations before a request is sent.

What changed (high level)

The existing add_image_to_pdf helper remains the concise single-placement API and now accepts optional sizing and accessibility fields. A separate add_images_to_pdf helper handles one or more typed PdfAddImageObject placements without exposing mode-dependent arguments on the simpler helper. Shared Pydantic payload models serialize uploaded resources to their server IDs and enforce the endpoint contract for both synchronous and asynchronous clients.

The public type surface now includes the placement object and documented content-structure values. A standalone example demonstrates multiple uploaded images, image reuse, sizing, page selection, and accessibility metadata.

Behavior changes

Image placements now support JPEG, PNG, TIFF, and GIF uploads, positive finite width and height values, page expressions, and semantic tag metadata. Batch placement coordinates must be non-negative, image resources are limited to one per placement, and tag metadata requires tagging to be enabled. Invalid combinations fail locally with Pydantic validation errors instead of reaching the service.

This is additive and does not remove the existing single-image workflow.

Validation

  • uv run pre-commit run --all-files
  • uv run pytest -n auto --maxschedchunk 2 -m 'not live' — 3,569 passed, 10 skipped
  • uvx nox -s tests -- -m 'not live' — Python 3.10 through 3.14 passed
  • Client class-function coverage gate — 175 functions passed the 90% threshold
  • uv run mkdocs build --strict
  • Live add-image suite collection — 86 tests collected
  • CI live rerun — 1,866 passed, 4 skipped, and 4 strict expected failures for the deployed Ruby and Warichu responses

The API-backed live suite could not be rerun locally because PDFREST_API_KEY was not available in the validation environment. The focused live cases for Ruby and Warichu are strict expected failures limited to PdfRestApiError, so CI will fail with an unexpected success when the deployed behavior is corrected.

Risks and follow-ups

This draft is stacked directly on #62 and should remain a draft until the preceding pull requests are merged. Once the stack lands, its base can be changed to main if GitHub does not retarget it automatically.

The Cloud OpenAPI schema and request validator list Ruby and Warichu as accepted structure types, while the deployed image-overlay operation currently rejects them with a fatal HTTP 400 response. The SDK retains the documented type contract, and the live suite tracks those two values as strict expected failures for both transports. Remove those markers when the service supports standalone image content with those structure elements.

- Add typed single- and multi-image placement controls for synchronous and
  asynchronous clients.
- Validate uploaded formats, page selections, dimensions, and accessibility
  metadata before requests are sent.
- Cover serialization, customization, boundaries, MIME formats, and live
  service behavior.

Assisted-by: Codex
- Add a standalone typed-placement example with checked-in PNG and JPEG
  resources.
- Link the expanded image workflow from the examples inventory and API guide.

Assisted-by: Codex
- Mark Ruby and Warichu image-overlay cases as strict expected failures for
  the deployed service's fatal 400 response.
- Fail on unexpected success so CI exposes when service support is restored.

Assisted-by: Codex

This branch was successfully deployed

1 active deployment
ci-live — e12f6eb3 Deployed Nov 10, 2026 by datalogics-tsmith via Examples (Python 3.11) #616
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