Maroto: A Go Library for Creating PDFs with Bootstrap-like Layouts

Summary
Maroto is an open-source Go library designed for creating PDFs in a fast and simple manner. It draws inspiration from Bootstrap, allowing developers to structure PDF content using a familiar grid system. This tool leverages gofpdf to provide an intuitive way to generate professional documents, automatically handling page breaks and headers.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
Maroto, a name derived from a Brazilian expression meaning an astute or clever person, is a powerful Go library for generating PDFs. It simplifies the complex process of PDF creation by adopting a layout approach similar to Bootstrap's grid system. Developers can define rows and columns, populating them with various components, making the process feel much like building a web page. Maroto intelligently manages page breaks, adding new pages as content expands and allowing for persistent headers across all pages. It is built upon the robust gofpdf library, ensuring reliable and high-quality PDF output.
Installation
Getting started with Maroto is straightforward. You can install the latest version using go get:
go get github.com/johnfercher/maroto/v2@v2.3.3
Examples
Maroto provides a clear and intuitive API for building your PDFs. You can define your document structure with rows, columns, and various elements. To explore practical implementations and see Maroto in action, you can run the examples included in the repository:
make examples
For comprehensive guidance and detailed code snippets, refer to the official Maroto v2 documentation.
Why Use Maroto?
Maroto offers several compelling reasons for developers looking to generate PDFs in Go:
- Bootstrap-Inspired Layout: Its grid system makes designing PDF layouts familiar and efficient for anyone accustomed to web development frameworks like Bootstrap.
- Simplicity and Speed: Designed for fast and simple PDF creation, it abstracts away much of the underlying complexity.
- Automatic Page Management: Maroto handles page breaks automatically, ensuring your content flows seamlessly across multiple pages without manual intervention.
- Persistent Headers: Easily define headers that will appear on every new page, perfect for branding or consistent information.
- Active Development: With a dedicated community and ongoing updates, Maroto continues to evolve and improve.
Links
- GitHub Repository: https://github.com/johnfercher/maroto
- GoDoc: https://pkg.go.dev/github.com/johnfercher/maroto/v2
- Maroto V2 Documentation: https://maroto.tech/#/README?id=maroto-v2
- Maroto V1 Branch: https://github.com/johnfercher/maroto/tree/v1
- Maroto V1 Documentation: https://maroto.tech/#/v1/README?id=deprecated