Go API

Go API

The Go API gives you direct access to the boxes and glue typesetting engine. The documentation is still in its early state and subject to change — please expect API changes until boxes and glue hits version 1.

Architecture overview

How the library is structured — frontend vs. backend, the node system, and how the pieces fit together.

First document

Start with an empty directory and finish with a one page PDF file with text broken into lines.

The frontend library

The high-level API for loading fonts, creating text, and placing content on pages.

The backend library

The low-level API for direct node manipulation and full control over every detail of the PDF output.

bagme

For the simplest case — rendering HTML/CSS fragments to PDF without dealing with the typesetting primitives — there’s bagme, a lightweight wrapper around htmlbag.