How johnfercher/maroto works
Maroto is a Go library for constructing PDFs with a Bootstrap-like row/column layout. The principal workflow is to configure a document, compose pages from rows, columns, and components, then generate and save a PDF. The graph also preserves documented page management and header/footer behavior, plus the rendering backend, code generation, caching, and metrics/reporting capabilities. Some branches are documented or indexed but their implementation was not excerpted, so those links are dashed where the connection is unverified.
Main entry points: maroto.go Document Orchestrator · provider.go Gofpdf Provider · metricsdecorator.go Metrics Decorator · page.go Pages and Headers
Components 19
Document Setup
- Config Builder
pkg/config/builder.go - Custom Fonts
pkg/fontrepository/fontrepository.go
Layout and Components
- Document Orchestrator
maroto.go - Rows and Columns
pkg/components/row/row.go - Pages and Headers
pkg/components/page/page.go - Text Components
pkg/components/text/text.go - Image Components
pkg/components/image/bytesimage.go - Barcode Components
pkg/components/code/barcode.go - Other Components
pkg/components
PDF Rendering
- Core Render Contracts
pkg/core/components.go - Gofpdf Provider
internal/providers/gofpdf/provider.go - Code Generation
internal/code/code.go - Cell Styling
internal/providers/gofpdf/cellwriter/cellwriter.go - Image Cache
internal/cache/cache.go
Output and Instrumentation
- PDF Document
pkg/core/pdf.go - Metrics Decorator
metricsdecorator.go - Metrics and Reports
pkg/metrics/metrics.go
Other components
- PDF Author
- File System
Connections 28
- PDF Author → Config Builder: sets options
- PDF Author → Document Orchestrator: builds document
- Config Builder → Document Orchestrator: configures
maroto.go - PDF Author → Custom Fonts: registers fonts
- Custom Fonts → File System: reads font files
pkg/fontrepository/fontrepository.go - PDF Author → Rows and Columns: composes rows
- Rows and Columns → Document Orchestrator: adds rows
- Document Orchestrator → Pages and Headers: manages pages
- PDF Author → Text Components: adds text
- PDF Author → Image Components: adds images
- PDF Author → Barcode Components: adds codes
- PDF Author → Other Components: adds elements
- Text Components → Core Render Contracts: renders through
- Image Components → Core Render Contracts: renders through
pkg/components/image/bytesimage.go - Barcode Components → Core Render Contracts: renders through
pkg/components/code/barcode.go - Document Orchestrator → Pages and Headers: renders pages
maroto.go - Pages and Headers → Gofpdf Provider: renders with
- Gofpdf Provider → Code Generation: generates codes
internal/providers/gofpdf/provider.go - Gofpdf Provider → Image Cache: reads and writes
internal/providers/gofpdf/provider.go - Gofpdf Provider → Cell Styling: applies cell styles
internal/providers/gofpdf/provider.go - Document Orchestrator → PDF Document: creates document
maroto.go - PDF Author → Metrics Decorator: decorates generation
- Metrics Decorator → Document Orchestrator: wraps document API
metricsdecorator.go - Metrics Decorator → Metrics and Reports: collects metrics
metricsdecorator.go - PDF Author → PDF Document: saves PDF
- PDF Author → Metrics and Reports: saves report
- PDF Document → File System: writes PDF
- Metrics and Reports → File System: writes report