folio

module
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: Apache-2.0

README

folio

Status Go Reference

Document rendering in pure Go.

PDF, SVG, EPUB, MOBI, CHM, FB2, DOCX, PPTX, XLSX, HTML and plain text.

Rendering

doc, err := pdf.Open("file.pdf")      // or svg.Open a drawing, html.Open a book or a document
defer doc.Close()

p, err := doc.Page(0)
img, err := p.ImageDPI(150)
txt, err := p.Text()

Supported

PDF paths, text, images, shadings, patterns, transparency, annotations, layers; damaged files repaired, encrypted files opened
SVG shapes, paths, text on a path and down the page, paint servers, clipping, masking, markers, filters
EPUB, MOBI, CHM, FB2, HTML, text container, HTML, CSS cascade and layout: floats, tables, pagination, writing modes, embedded fonts
DOCX, PPTX, XLSX styles, lists, tables, pictures, footnotes; a slide is a page, a sheet a part, cells formatted as the file asks

A page also reads as structured text with the box every character occupies, as plain text, as its links, as SVG and as HTML, and a reflowable document as Markdown. A document carries its outline, metadata and page labels.

Not in scope: writing or editing documents, form field values, JavaScript, XFA, signature validation, PDF/A validation.

Packages

doc one Open over the three, for a file of unknown format
pdf the content interpreter and the public API
svg a drawing as a document of its own
html reflowable and office documents, and the layout over them
gfx the device interface and the devices behind it
raster the 2D engine: paths, rasterizer, pixmaps, blend modes
font font programs in, outlines and metrics out
syntax the file format: objects, filters, encryption, repair

Every format renders through one gfx.Device, so a caller can drive something other than the rasterizer. raster and font know nothing about PDF, gfx knows no file format, and syntax has no graphics in it.

Correctness

Objects, device calls, glyphs, text and rendered pixels are each compared against the established implementations: MuPDF, poppler, qpdf, AGG, OpenJPEG, cairo, Ghostscript, librsvg, resvg and a browser.

License

Apache-2.0. NOTICE lists what this derives from.

Directories

Path Synopsis
Package doc opens a document without the caller knowing what it is.
Package doc opens a document without the caller knowing what it is.
Package font reads font programs and returns glyph outlines and metrics.
Package font reads font programs and returns glyph outlines and metrics.
Package gfx is the graphics model a document is drawn through: the Device interface, the devices behind it, color spaces, and the text, image and shading a device is handed.
Package gfx is the graphics model a document is drawn through: the Device interface, the devices behind it, color spaces, and the text, image and shading a device is handed.
Package html reads reflowable documents: EPUB, MOBI, CHM, FB2, DOCX, PPTX, XLSX and plain text.
Package html reads reflowable documents: EPUB, MOBI, CHM, FB2, DOCX, PPTX, XLSX and plain text.
Package pdf renders PDF documents.
Package pdf renders PDF documents.
Package raster is a two dimensional graphics engine: paths, curve flattening, an anti-aliased cell rasterizer with both fill rules, a stroker and a dasher, clip masks, pixmaps of one to four color components with an optional alpha channel, and the span pipeline over them.
Package raster is a two dimensional graphics engine: paths, curve flattening, an anti-aliased cell rasterizer with both fill rules, a stroker and a dasher, clip masks, pixmaps of one to four color components with an optional alpha channel, and the span pipeline over them.
Package svg renders an SVG drawing.
Package svg renders an SVG drawing.
Package syntax reads the PDF file format: objects, cross references, object streams, damaged file recovery, the stream filters and encryption.
Package syntax reads the PDF file format: objects, cross references, object streams, damaged file recovery, the stream filters and encryption.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL