gowkhtmltopdf is a pure-Go, no-cgo PDF and image engine that renders HTML templates into invoices, receipts, certificates, statements, posters and multi-page reports, delivered as two static binaries, a Go library, and Python bindings.
What is gowkhtmltopdf?
gowkhtmltopdf is an HTML-to-PDF and HTML-to-image rendering engine written in Go that converts HTML templates into PDF or image output without a browser process, cgo, or an external native converter. It accepts HTML files or in-memory HTML bytes and produces PDF documents (default PDF 1.4, opt-in PDF 1.7 or 2.0) and images, using an in-repo pipeline rather than Chrome. It is a clean-room work-alike of the wkhtmltopdf CLI surface, requires Go 1.26+, and is MIT-licensed, copyright 2026 Chinmay Sawant. The current release is v0.2.5, with the Document API and explicit CLI grammar as the supported surface.
What makes gowkhtmltopdf stand out?
- No cgo, no browser process — native builds spawn no browser and no native converter process; two static binaries,
gowkhtmltopdfandgowkhtmltoimage, plus the Go library, run the pipeline in-process. - Three integration surfaces — the CLI, the Go
Document/ImageDocumentAPI that returns PDF bytes from aPDF(ctx)call, and Python bindings installed with pip that share the same engine through an opt-in shared library built with CGO_ENABLED=1. - Structured document features — headers, footers, tables of contents, PDF outlines/bookmarks, page breaks, tables, and multi-page documents with no wrappers.
- PDF version and profile control — default PDF 1.4; opt-in PDF 1.7 / 2.0 through
--pdf-version; PDF/A-3a plus PDF/UA-1 via--pdf-profile a3a-ua1(implies 1.7) and PDF/A-4 plus PDF/UA-2 viaa4-ua2(implies 2.0). - Allowlisted dependencies — direct modules are limited to
go-text/typesettingfor OpenType shaping andtdewolff/canvasfor SVG rasterization. - WASM preview adapter — an opt-in browser build runs the same pipeline through WebAssembly for inline HTML previews.
- Measured throughput — against wkhtmltopdf 0.12.6.1 on Linux amd64 (Intel Core i7-13700HX): 2 pages 17 ms vs 259 ms (15.5x), 10 pages 30 ms vs 276 ms (9.2x), 100 pages 184 ms vs 526 ms (2.9x).
Who should use gowkhtmltopdf?
Go backend developers who need to turn invoice or statement templates into PDFs inside a service without installing Chrome or wkhtmltopdf on the host. Compliance and archiving teams that must emit PDF/A-3a with PDF/UA-1 or PDF/A-4 with PDF/UA-2 tagged output. Python developers who want in-process conversion through the pip-installed bindings. Platform teams building minimal containers around static binaries with no cgo and no browser runtime.
Use cases
- Billing and accounting systems: render invoices and receipts from HTML templates directly in a Go service, with page breaks and headers/footers.
- Long report generation: produce 100-page-plus statements and tables with a table of contents and PDF bookmarks.
- Certificates, storybooks and posters: generate one-off or batch documents and rasterize them to images with
gowkhtmltoimage. - In-app previews: use the opt-in WASM adapter to show inline HTML previews in the browser.
How does gowkhtmltopdf work?
The engine runs an in-repo pipeline: load, parse, style, layout, paginate, paint, then write. From the CLI you build with make build and run the binary against an HTML file with an output path; from Go you construct a Document with explicit Content sources and page settings such as A4, then call the PDF method.
Pros and cons
- Fast at every tested page size versus wkhtmltopdf, with lower peak RSS through 100 pages and higher from 200 pages on the generic path.
- Ships as static binaries with no browser, cgo, or converter process; MIT licensed.
- Implements a print CSS subset only: no JavaScript and no Chrome visual parity.
- CJK and complex Unicode support is partial, handled through Type0/CID fonts and a font path flag.
- The
masterbranch tracks active development and may be broken; stable builds come from tagged releases.
Pricing
gowkhtmltopdf is free and open source under the MIT License. Bundled Liberation and DejaVu fonts ship under SIL OFL / Bitstream Vera terms, and the Noto KR test subset includes its own OFL notice.
Alternatives
wkhtmltopdf is the CLI surface this engine mirrors as a clean-room work-alike, but it runs as an external patched-Qt binary. WeasyPrint and Puppeteer/Chrome are compared directly in the project's own benchmarks against the same fixtures.
FAQ
Is gowkhtmltopdf free?
Yes. It is released under the MIT License, copyright 2026 Chinmay Sawant. There is no paid tier mentioned on the project page, and the CLI, Go library, and Python bindings all come from the same open-source repository.
Does gowkhtmltopdf need Chrome or a browser installed?
No. Native builds use no browser process, no cgo, and no native converter process. A separate opt-in build can run the same pipeline through WebAssembly in a browser for inline HTML previews, but that is not required for PDF generation.
Does gowkhtmltopdf support JavaScript or full CSS?
No. It implements a print CSS subset and runs no JavaScript, so it does not aim for Chrome visual parity. The repository publishes a per-element, per-property, and per-flag compatibility matrix covering exactly what is supported.
What PDF versions and accessibility profiles are supported?
Output defaults to PDF 1.4. You can opt into PDF 1.7 or 2.0 with the PDF version flag, and choose PDF/A-3a with PDF/UA-1 or PDF/A-4 with PDF/UA-2 through the profile flag or the Go API.
Can I use gowkhtmltopdf from Python?
Yes. Python callers get the same engine in-process after installing the package with pip; the shared library is built with CGO_ENABLED=1, and the repository includes Python benchmark and sample targets.








