Building a HTML to PDF API using Go and wkhtmltopdf
Tony
Posted on October 21, 2021
Generating PDFs in code is difficult. Many solutions revolve around unfamiliar proprietary APIs that require pixel perfect placement of text and images that can become a nightmare in the long run.
This tutorial uses HTML, CSS, and Go to achieve a lightweight, modern approach to dynamically creating and serving PDFs from an API endpoint.
Introduction
This tutorial follows how our team replaced our exsting PDF generation system. The decision for us to use wkhtmltopdf was primarily driven by our use of Golang on the backend and the
allure of keeping our services as small as possible.
I recognize some teams may be interested in a Chromium/Puppeteer approach to PDF's and I've linked some helpful articles to get you started.
Continue reading on the ShareBuilder 401k Blog ->
You can checkout the template golang + go-wkhtmltopdf project if you'd like to skip straight to code.
Cheers,
Tony
Posted on October 21, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.