Skip to content

PDFCLOUD-6254: Convert structured documents to PDF - #47

Draft
datalogics-kam wants to merge 10 commits into
pdfcloud-6243-pdf-with-added-shapesfrom
pdfcloud-6254-add-structured-document-conversions
Draft

PDFCLOUD-6254: Convert structured documents to PDF#47
datalogics-kam wants to merge 10 commits into
pdfcloud-6243-pdf-with-added-shapesfrom
pdfcloud-6254-add-structured-document-conversions

Conversation

@datalogics-kam

Copy link
Copy Markdown
Contributor

PDFCLOUD-6254

Why this change

The SDK could not convert structured Markdown, plain text, JSON, XML, or CSV documents through the documented POST /pdf capability. Callers had to construct untyped requests and could accidentally combine options that the service accepts only for particular source formats.

What changed (high level)

The synchronous and asynchronous clients now provide five format-specific helpers backed by Pydantic payload models and public structured-document types. Format-specific signatures keep incompatible options separate while shared page, typography, table, color, and output settings serialize to the API's structured_text_options object. Markdown image mappings accept uploaded resources and internally deduplicate their IDs.

Behavior changes

Callers upload a source document and pass its PdfRestFile to convert_markdown_to_pdf, convert_plain_text_to_pdf, convert_json_to_pdf, convert_xml_to_pdf, or convert_csv_to_pdf. Local validation rejects the wrong source format, multiple source files, unsupported Markdown image MIME types, and invalid literal or numeric options before transport. The SDK adds a runnable combined example, fixtures, generated API-guide links, and documented Literal value meanings. This is a feature release from 1.1.0 to 1.2.0; no existing public APIs change.

Validation

  • uv run pytest -n auto --maxschedchunk 2 tests/test_convert_structured_documents_to_pdf.py — 121 passed, 10 expected matching-format skips.
  • PDFREST_LIVE_BASE_URL=http://sleipnir:3000 uvx nox -s tests-3.11 -- tests/live/test_live_convert_structured_documents_to_pdf.py — 32 passed.
  • Focused Ruff, BasedPyright, and pre-commit checks passed.
  • Strict MkDocs build passed during the feature work. A full local pytest run remains environment-limited because the default localhost service does not provide the new structured conversion endpoints; the focused live run above targets the supplied service.

Risks and follow-ups

This is a stacked draft PR on #45: merge #45 first, then this PR. The base is pdfcloud-6243-pdf-with-added-shapes, so reviewers see only the structured-document conversion layer. The live coverage depends on the supplied sleipnir:3000 service. No breaking changes are intended.

- Export public structured document types for page, style, table, and
  format-specific options.
- Add format-specific payload validation and nested wire serialization.
- Deduplicate uploaded Markdown images into ordered resource IDs.

Assisted-by: Codex
- Add synchronous and asynchronous helpers for Markdown, plain text,
  JSON, XML, and CSV inputs.
- Cover exact request serialization, validation boundaries, transport
  behavior, and request customization.

Assisted-by: Codex
- Exercise all five structured formats through synchronous and
  asynchronous clients.
- Verify Markdown image resources, response metadata, and server-side
  invalid-option handling against deterministic fixtures.

Assisted-by: Codex
- Add a runnable upload-first example covering Markdown, plain text,
  JSON, XML, and CSV helpers.
- Add deterministic source documents and register the example in the
  inventory.

Assisted-by: Codex
- Add all five format-specific conversion helpers to the Into PDF API
  guide.
- Link generated method signatures to their public structured option
  types.

Assisted-by: Codex
- Release the structured document conversion helpers as a minor feature
  update.
- Keep the project metadata and lockfile package version synchronized.

Assisted-by: Codex
- Explain data presentation, page orientation, image alt-text policy,
  line handling, and CSV alignment values.
- Keep value documentation on public aliases for generated API reference
  reuse.

Assisted-by: Codex
Exercise every structured-document literal through both client transports
against the live service, including shared page orientation.

Assisted-by: Codex
Verify every helper rejects every other structured source before
transport, and covers sync and async request customization timeouts.

Assisted-by: Codex
Reject below-minimum page, style, table, color, and CSV values so
structured conversion constraints are tested on both boundaries.

Assisted-by: Codex
@datalogics-kam
datalogics-kam force-pushed the pdfcloud-6254-add-structured-document-conversions branch from ce87afd to 8a5b039 Compare August 29, 2026 14:57
@datalogics-kam
datalogics-kam force-pushed the pdfcloud-6243-pdf-with-added-shapes branch from aad4964 to 4ef4925 Compare August 29, 2026 14:58
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