Api2Pdf
Replaceable in one session with an AI coding agent.
A pay-per-use PDF and document conversion API wrapping several engines: Chromium, LibreOffice and image tools behind one endpoint.
Build me the document conversion service that replaces Api2Pdf. The useful idea is the wrapper: **one endpoint, several engines, chosen by what came in.** That routing is the whole design. STACK - Node 20+ with Fastify - SQLite through better-sqlite3, WAL mode - Playwright with Chromium for HTML, LibreOffice headless for Office documents, ImageMagick and Ghostscript for the rest - Caddy in front THE ROUTER - HTML or a URL goes to Chromium - .docx, .xlsx, .pptx and .odt go to LibreOffice headless - Images go to ImageMagick; PDF merging, splitting and compression to Ghostscript or qpdf - **Detect the type from the bytes, never from the extension.** It decides which engine runs, and letting the caller choose is how you feed a crafted file to the wrong tool THE ENGINES, EACH WITH ITS OWN TRAP - **Chromium**: recycle the pool, wait for fonts, kill on timeout, block internal addresses after redirects - **LibreOffice**: it is slow, it is single-threaded per instance, and it occasionally hangs. Run it in a subprocess with a hard timeout and a kill, one document at a time per worker. **Fonts must be installed on the machine** or a Word document renders in a substitute and the layout moves - **Ghostscript and ImageMagick**: both have had serious vulnerabilities involving crafted input files. Keep them current, run them with a restrictive policy file, and never pass caller-controlled options through to the command line SAFETY, WHICH IS THE MAIN EVENT HERE - **You are running four programs over files strangers send you.** Every one of them is an attack surface with a history - Each conversion in its own container or namespace, unprivileged, with no network, a memory limit, a CPU limit and a wall-clock limit - Never build a shell command from user input. Pass arguments as an array, always - Size, page count and dimension caps before anything starts - Delete the input immediately after conversion THE API - POST returns a job id; everything queued, nothing rendered in the request - Per-engine concurrency limits, because LibreOffice and Chromium have completely different capacity profiles - A queue depth limit that returns a clear error when full - Signed expiring URLs for output, and a retention sweeper that actually deletes OPERATIONS - Per-engine duration percentiles, timeout rate and failure rate. **The timeout rate per engine tells you which one needs more capacity** and they never need it at the same time - Store the input hash and deduplicate WHAT MATTERS MOST Sandboxing each engine and detecting the type from the bytes. This service's job is running risky software on untrusted files, and everything else is secondary to containing that.
What you lose
- Several engines kept working behind one interface
- Office document conversion, which is genuinely awkward
- Per-use pricing with no monthly commitment
- Nothing to patch or scale
If you would rather not build
- The individual tools called directly, if you only need one
The escape hatch
open source · no votes, no paid placement
Gotenberg
$0Containerised conversion API over Chromium and LibreOffice.
gotenberg/gotenbergfree · open source
Stirling PDF
$0Self-hosted PDF manipulation with a web interface and an API.
Stirling-Tools/Stirling-PDFfree · open source
Why this verdict
our own opinion · changed only by a person
86/100
Verdict yes at 86: Gotenberg already wraps most of these engines. The entry leads with sandboxing because that is genuinely the whole risk of the category.
History
tracked since 14 Aug 2026 · nothing is ever overwritten
Nothing recorded yet. This chart fills in once the page has visitors, votes or prompt copies — it will not draw a flat line to look busy.
Questions about Api2Pdf
answered from the record above
Is Api2Pdf free?
Api2Pdf charges per use rather than a subscription; there is no monthly plan.
Can you replace Api2Pdf by building your own?
YES. Replaceable in one session with an AI coding agent. Replacement score 86 out of 100, build time one session. Read what you lose before you decide.
How much does Api2Pdf cost?
Api2Pdf has no public headline price. The tier we track is the entry plan.
What do you lose by replacing Api2Pdf?
Several engines kept working behind one interface; Office document conversion, which is genuinely awkward; Per-use pricing with no monthly commitment; Nothing to patch or scale. If any of those carry weight for you, keep paying.
Is there an open-source alternative to Api2Pdf?
Yes: Gotenberg, Stirling PDF. The prompt on this page is for when you want it your way instead.
Related entries
same category first, most replaced first
Every week, something stops being worth paying for.
New verdicts, prices that moved, entries added. One email a week. Unsubscribe in one click. Nothing is being sent yet — your address is kept here, and the first issue is the first thing it is used for.
free forever · no tracking pixel · stored here, never passed to anyone

