HTML to PDF in your language
One POST and a PDF comes back, so any HTTP client will do. These pages carry the version written the way that language is normally written, and the trap it sets — which is usually reading a binary response as text.
Official clients
Three languages have a published client. Each has no dependencies of its own, retries the failures worth retrying and none of the others, and turns the API’s error envelope into a typed error you can branch on. All three are generated against the same contract the API validates requests with, so their types cannot drift from the server.
| Language | Install | Registry |
|---|---|---|
| Node.js | npm install @pdfcraft-dev/pdf | npm |
| Python | pip install pdfcraft | PyPI |
| Go | go get github.com/igaurav-dev/pdfcraft-go | pkg.go.dev |
| TypeScript | npm install @pdfcraft-dev/pdf | npm |
Every language
The other nine pages show raw HTTP, because in those languages that genuinely is the best answer — and it is a perfectly good answer in the three above too.
- HTML to PDF in Node.js — official client — There is a first-party SDK — `npm i @pdfcraft-dev/pdf` — with zero dependencies and typed …
- HTML to PDF in Python — official client — `response.content`, not `response.text`. `.text` decodes the bytes as a string and the PDF…
- HTML to PDF in Go — official client — `io.Copy` straight from the response body to the file — never `io.ReadAll` into memory fir…
- HTML to PDF in PHP — CURLOPT_RETURNTRANSFER must be true or curl_exec prints the PDF straight to the output buf…
- HTML to PDF in Ruby — `File.binwrite`, not `File.write`. On any platform with newline translation, `write` corru…
- HTML to PDF in Java — `BodyHandlers.ofFile` streams the response straight to disk without ever holding the PDF i…
- HTML to PDF in C# — Reuse one HttpClient for the life of the process. A `using var client = new HttpClient()` …
- HTML to PDF in Rust — `.error_for_status()?` before reading the body, or a 429 gets written to disk as a PDF con…
- HTML to PDF in curl — `--output` rather than a shell redirect, so curl can still write its own errors to the ter…
- HTML to PDF in Deno — Run with `--allow-net=api.pdfcraft.dev --allow-env --allow-write`. Deno will not make the …
- HTML to PDF in Bun — `Bun.write` takes an ArrayBuffer directly, so there is no Buffer round-trip for the render…
- HTML to PDF in TypeScript — official client — Zero dependencies, and the option types are generated from the same contract the server va…