Skip to content

boxesandglue/boxesandglue-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

boxes and glue — examples

Working examples for the boxes and glue PDF typesetting library: a Go port of TeX-style line breaking and page layout, with high-level wrappers for HTML, Markdown, XSL-FO and direct Lua scripting.

The examples are split by which layer of the stack they exercise:

  • glu — the scripting tool: HTML, Markdown, XSL-FO, Lua
  • frontend — the high-level Go API: paragraphs, tables, font families
  • baseline — the low-level PDF writer: pages, fonts, annotations, outlines, image embedding
  • fonts — shared font assets used by several examples

Every example ships a runnable source file, a generated PDF, and (for PDF-producing examples) a firstpage.png preview rendered with pdftoppm at 150 dpi.

glu

See glu/Readme.md for the full thematic listing — HTML floats, an XSL-FO walker, Markdown barcodes / slides, and direct Lua bindings (text shaping, ZUGFeRD invoices).

Pick of the pack:

Description Preview
Floats / inserts — top / bottom floats and footnotes via plain CSS
XSL-FO walker — XSL-FO front matter handed to htmlbag
PDF/UA tagging — ISO 14289-1 accessibility
Markdown slides — 16:9 deck from Markdown
Markdown alignment{.class} heading attributes, German hyphenation, -bag-linebreak-* tuning
Barcodes — EAN-13, Code 128, QR via the <barcode> element
ZUGFeRD invoice — EN 16931 PDF/A-3

frontend

The high-level Go API — frontend.Document, font families, paragraph formatting, tables. Run any example with go run main.go from inside its directory.

Description Preview
Hello world — smallest end-to-end frontend program
Simple table — row / column basics
Table with cell spanscolspan / rowspan from XML

baseline

The low-level baseline-pdf writer — direct PDF object construction, no frontend layer, no paragraph builder. Useful for understanding what the higher levels add (and for the rare case where you need to emit PDF objects by hand). Run any example with go run main.go.

Description Preview
Font — load a font and write a glyph
Image — import a PDF as a Form XObject
Annotation (hyperlink) — clickable URI annotation

fonts

Shared font assets used by several examples (loaded via relative paths from the example directory). Currently:

  • fonts/crimsonpro/ — Crimson Pro (SIL Open Font Licence 1.1) in Regular / Italic / Bold / BoldItalic.

Documentation

About

Examples for the boxes and glue library

Resources

Stars

Watchers

Forks

Contributors