html4pdf vs Gotenberg

This is the closest comparison on the site, because Gotenberg is the same idea: an HTTP API in front of a renderer. The difference is who operates it.

The short answer

Gotenberg is the right answer if you want this capability inside your own infrastructure and have somewhere to run a container. We are the right answer if you want it without running anything.

What Gotenberg is

Gotenberg is an open source Docker container exposing a document conversion API. It wraps headless Chromium for HTML and URLs, and LibreOffice for Office documents, behind a consistent HTTP interface. It is free, actively maintained, and converts formats we do not touch, such as docx and xlsx.

Side by side

 Gotenberghtml4pdf
LicenceOpen source, freePaid per document
Who runs itYou, as a containerWe do
Office documentsYes, via LibreOfficeNo, HTML, URLs and templates
MemoryYou size it, Chromium and LibreOffice are both hungryNot your concern
ScalingYour orchestrator, your autoscaling rulesIncluded
DataNever leaves your networkRendered in memory, never stored
TemplatesBring your ownInvoice, receipt, contract and certificate built in
UpdatesYou pull and redeployNothing to do
Cost at volumeOne instance, however many documentsPer document

Choose Gotenberg when

  • Documents must stay inside your network, with no outbound call at all.
  • You need Word and Excel conversion as well as HTML.
  • You run Kubernetes or similar and adding a container is routine.
  • Volume is high and steady, where one instance beats per-document pricing comfortably.

Choose html4pdf when

  • You do not want another service in your deployment, however good it is.
  • Traffic is spiky, and an instance sized for the peak is idle most of the week.
  • You want built-in document templates rather than writing HTML for every type.
  • Nobody on the team wants to own the renderer when it falls over on a Sunday.

See the code

The working example, in the language this decision is being made in.

Gotenberg: common questions

Is Gotenberg free?

Yes, it is open source and free to run. The cost is the infrastructure it sits on and the attention it needs, which is the real comparison rather than the licence.

Can Gotenberg convert Word documents?

Yes, through LibreOffice. That is a genuine capability we do not have: we take HTML, URLs and JSON templates.

Should I self-host instead of using an API?

If your volume is steady and high, or your data cannot leave the network, self-hosting is the better economics and the better answer. If PDFs are occasional, you are paying for an idle instance and the time to keep it healthy.

Can I move between them later?

Both are HTTP APIs taking HTML, so the swap is contained. Keep the call behind one function in your codebase and it is an afternoon either way.

Try it before you decide

New accounts get 10 free credits, no card. Send the HTML you already have and compare the output against whatever you are using now.

Get API key

Other comparisons