We needed a way to generate PDF documents from Go. These vary from invoices with highly customizable layouts to reports with tables, graphs and images. In our opinion, the best way to do this was by using HTML/CSS templates as a source for our PDFs. Using CSS print media types and millimeters instead of pixel units we can generate very accurate PDF documents using wkhtmltopdf. It takes care of setting the correct order of options as these can become very long with multiple pages where you have page and TOC options for each page. It makes usage in server-type applications easier, every instance (PDF process) has its own output buffer which contains the PDF output and you can feed one input document from an io.Reader (using stdin in wkhtmltopdf). You can combine any number of external HTML documents (HTTP(S) links) with at most one HTML document from stdin and set options for each input document.

Features

  • Golang commandline wrapper for wkhtmltopdf
  • go-wkhtmltopdf is a pure Golang wrapper around the wkhtmltopdf command line utility
  • It takes care of setting the correct order of options as these can become very long with muliple pages where you have page and TOC options for each page
  • ou can also ignore the internal buffer and let wkhtmltopdf write directly to disk if required for large files
  • The package now has the possibility to save the PDF Generator object as JSON and to create a new PDF Generator from a JSON file
  • The speed if pretty much determined by wkhtmltopdf itself

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow go-wkhtmltopdf

go-wkhtmltopdf Web Site

Other Useful Business Software
AI-generated apps that pass security review Icon
AI-generated apps that pass security review

Stop waiting on engineering. Build production-ready internal tools with AI—on your company data, in your cloud.

Retool lets you generate dashboards, admin panels, and workflows directly on your data. Type something like “Build me a revenue dashboard on my Stripe data” and get a working app with security, permissions, and compliance built in from day one. Whether on our cloud or self-hosted, create the internal software your team needs without compromising enterprise standards or control.
Try Retool free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of go-wkhtmltopdf!

Additional Project Details

Programming Language

Go

Related Categories

Go Command Line Tools

Registered

2023-05-02