Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. go-wkhtmltopdf

go-wkhtmltopdf

MITGov1.9.3

A Go wrapper for wkhtmltopdf that provides a type-safe interface to generate PDFs from HTML.

GitHubGitHub
1.2k stars158 forks0 contributors

What is go-wkhtmltopdf?

go-wkhtmltopdf is a Go wrapper for the wkhtmltopdf command-line tool, allowing developers to generate PDF documents from HTML/CSS templates directly within Go applications. It solves the need for creating customizable, print-ready documents like invoices and reports by leveraging HTML's styling capabilities. The library provides a type-safe, idiomatic Go API that simplifies wkhtmltopdf's extensive options.

Target Audience

Go developers who need to generate PDFs from HTML in server-side applications, such as web services generating invoices, reports, or other printable documents.

Value Proposition

Developers choose go-wkhtmltopdf for its type-safe interface that reduces errors and enhances IDE support, its flexibility in handling multiple HTML sources, and its JSON serialization feature for distributed PDF generation workflows.

Overview

Golang commandline wrapper for wkhtmltopdf

Use Cases

Best For

  • Generating invoices with custom HTML/CSS layouts in Go web applications
  • Creating printable reports with tables and graphs from HTML templates
  • Building server-side PDF generation services that combine multiple HTML sources
  • Implementing PDF workflows where configuration needs to be serialized (e.g., client-server architectures)
  • Migrating existing wkhtmltopdf usage to a type-safe Go environment
  • Developing on AWS Lambda with PDF generation via JSON configuration

Not Ideal For

  • Projects starting from scratch that require a future-proof, actively maintained PDF generation solution
  • Applications needing support for modern CSS features or complex JavaScript rendering beyond wkhtmltopdf's capabilities
  • Environments where installing and managing external binary dependencies (wkhtmltopdf) is restricted or cumbersome
  • High-throughput systems demanding faster PDF generation than wkhtmltopdf's rendering engine can provide

Pros & Cons

Pros

Type-Safe Configuration

All wkhtmltopdf settings are exposed as typed struct fields, ensuring compile-time safety and IDE autocompletion, as demonstrated in the code examples for Dpi, PageSize, and other options.

Flexible HTML Input

Supports combining HTML from URLs, local files, or in-memory readers via stdin, allowing versatile document assembly in a single PDF, as shown with NewPage and NewPageReader.

Serialization for Distributed Workflows

Configurations can be saved and loaded as JSON, enabling client-server setups or AWS Lambda integration, with examples provided for NewPDFPreparer and NewPDFGeneratorFromJSON.

Cons

Deprecated Underlying Tool

Relies on wkhtmltopdf, which is archived and no longer maintained, meaning no updates, security fixes, or compatibility with new web standards, as explicitly warned in the README.

External Binary Dependency

Requires wkhtmltopdf to be installed separately on the system, adding deployment complexity and potential versioning issues, with path resolution noted as a setup step.

Performance Tied to wkhtmltopdf

Speed is limited by wkhtmltopdf's rendering engine, which may not be optimal for high-volume or real-time generation compared to native Go libraries or headless browsers.

Frequently Asked Questions

Quick Stats

Stars1,175
Forks158
Contributors0
Open Issues10
Last commit6 months ago
CreatedSince 2015

Tags

#html-to-pdf#server-side#go-library#html#golang#serialization#type-safe#pdf-generation#pdf-document#go#wkhtmltopdf#pdf

Built With

G
Go

Included in

Go169.1k
Auto-fetched 1 minute ago

Related Projects

pdfcpupdfcpu

A PDF processor written in Go.

Stars8,595
Forks607
Last commit7 hours ago
aferoafero

The Universal Filesystem Abstraction for Go

Stars6,638
Forks561
Last commit23 days ago
gdugdu

Fast disk usage analyzer with console interface written in Go

Stars5,605
Forks202
Last commit2 days ago
notifynotify

File system event notification library on steroids.

Stars929
Forks136
Last commit2 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub