Skip to content

PDFCLOUD-6570 Add PDF-to-PostScript conversion - #54

Closed
datalogics-tsmith wants to merge 5 commits into
pdfrest:mainfrom
datalogics-tsmith:pdfcloud-6570-add-pdf-to-postscript-conversion
Closed

datalogics-tsmith wants to merge 5 commits into
pdfrest:mainfrom
datalogics-tsmith:pdfcloud-6570-add-pdf-to-postscript-conversion

Conversation

@datalogics-tsmith

Copy link
Copy Markdown
Contributor

PDFCLOUD-6570

Why this change

The Python SDK did not expose pdfRest's PDF-to-PostScript operation, requiring callers to assemble requests outside the typed client. This adds a supported sync and async workflow for converting uploaded PDFs into print-oriented PostScript.

What changed (high level)

The new convert_pdf_to_postscript helpers accept uploaded PdfRestFile resources and delegate request validation and serialization to a dedicated Pydantic payload model. A public PostScriptLevel type makes the supported language levels discoverable, while the existing file-operation machinery resolves the generated resource into a typed response.

Documentation and runnable sync and async examples demonstrate the upload, conversion, download, and verification flow. The package version moves to 1.4.0 for the additive public API.

Behavior changes

Callers can now select PostScript level 2 or 3, page ranges, binary or text-safe output, scaling, rotation, shrink-to-fit behavior, printable annotations, and an optional output prefix. Omitting the output prefix leaves server-generated naming intact.

Invalid MIME types, multiple input resources, unsupported language levels, malformed page ranges, non-positive or non-finite scales, and invalid output prefixes fail locally before transport. There are no breaking changes to existing APIs.

Validation

Focused validation passed with 46 unit tests and 24 live sync/async tests against the local pdfRest service. The live suite isolates each route option and verifies concrete PostScript markers for text-safe output, language level, page selection, and the legal scale boundary.

The Python 3.10–3.14 non-live Nox matrix passed with 2,969 tests and 10 expected skips per interpreter at 95% overall coverage. The class-function coverage gate checked 165 functions and passed its 90% threshold. Ruff, configured basedpyright, strict MkDocs, package build, and diff checks also passed. The final rebase was patch-identical by git range-diff, followed by another focused unit and live run.

The pre-commit file checks passed except that its basedpyright subprocess could not discover installed dependencies in the sandbox; an equivalent full configured basedpyright run completed with zero errors or warnings.

Risks and follow-ups

The public API is additive and uses the existing request and response infrastructure, so migration risk is low. Live assertions use deterministic checked-in PDFs; rotation, shrink-to-fit, and annotation toggles are isolated and exercised through both transports, while binary-output and scale effects have direct output assertions. CI should provide the final clean-environment verification of the pre-commit hook and interpreter matrix.

- Export the supported PostScript language levels for client callers.
- Validate uploaded PDFs, page ranges, scale values, and output names.
- Serialize the payload into the fields expected by the service.

Assisted-by: Codex
- Expose sync and async helpers with typed conversion options.
- Cover request serialization, validation, responses, and timeouts.
- Bump the feature release version to 1.4.0.

Assisted-by: Codex
- Exercise both language levels through sync and async clients.
- Assert output metadata, page count, and language-level markers.
- Confirm the service rejects invalid levels, ranges, and scales.

Assisted-by: Codex
- Add runnable sync and async examples for PostScript levels 3 and 2.
- Verify generated headers, language levels, page counts, and metadata.
- Link the route and examples from the public documentation indexes.

Assisted-by: Codex
- Verify default output serialization through both client transports.
- Isolate live options and assert observable PostScript markers.
- Derive live scale boundary cases from the payload schema.

Assisted-by: Codex
@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for pdfrest-python ready!

Name Link
🔨 Latest commit 1efad81
🔍 Latest deploy log https://app.netlify.com/projects/pdfrest-python/deploys/6ad67f98e3a7ef336408ec7e
😎 Deploy Preview https://deploy-preview-54--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.

@datalogics-tsmith

Copy link
Copy Markdown
Contributor Author

Superseded by #55, which uses the upstream-owned branch so the full CI and live-test credentials are available.

This branch was successfully deployed

1 active deployment
ci-live — 1efad816 Deployed Oct 19, 2026 by datalogics-tsmith via Examples (Python 3.12) #576
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