Menu

1 / 2

URL publication-quality PDF in one POST request

DEV Community·Numerix Labs·6 months ago
#ieieFsB2
#api#showdev#tooling#format#chromium
Reading 0:00
15s threshold

If you've ever tried to "just turn this page into a PDF on the server," you probably spent a Saturday on it.

Headless Chromium works — until it doesn't. CSS backgrounds disappear. Custom fonts come out as squares. The Lambda cold-starts a fresh Chromium each invocation and the first three PDFs of the morning take eleven seconds. By the time the PDF looks right and renders fast, you've shipped half a stack to keep one Chromium process happy.

So we made a smaller version of that problem: POST a URL, get a PDF back.

curl -X POST https://api.numerixlabs.com/screenshot \ -H "Authorization: Bearer $SNAPAPI_KEY " \ -H "Content-Type: application/json" \ -d '{"url":"https://example.com/invoice/42","format":"pdf"}' \ -o invoice-42.pdf

Enter fullscreen mode

Exit fullscreen mode

That's the whole API. No render queue, no font upload pipeline, no Chromium process to babysit.

What "publication-quality" means here

It's easy to render a PDF that looks right in a viewer and falls apart when you print it.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.