Core concepts
Flow models a PDF as a document, pages, and ordered page elements. Its builders let you configure each scope with chained methods and callbacks.
Document builder
DocumentBuilder.Create() creates the root builder. Configure document metadata, default units, shared styles, security, and outlines here. Add pages with Pages(...), and finish by saving to a file, stream, or byte array.
Licensing must be configured before calling Create(). The repository README demonstrates Licensing.Community(); consult the current license file for the terms that apply to your project.
Pages and units
Each Pages(...) callback receives a PageBuilder. Set the page size and margins, then add elements in the order they should appear. DefaultUnit(...) sets the unit used when a value omits one; individual methods that accept an optional LengthUnit can override it.
The source currently initializes the default unit to pixels. Set it explicitly when your document relies on a different measurement system.
DocumentBuilder.Create()
.DefaultUnit(LengthUnit.Point)
.Pages(page => page
.Size(PageSize.A4)
.Margins(48)
.Text("First line")
.Spacing(12)
.Text("Next line"))
.Save("output.pdf");
Pages(count, callback) creates the requested number of pages and passes a zero-based index to its callback. For other page-specific operations, see the PageBuilder reference.
Elements and layout
PageBuilder exposes methods for text, images, tables, rectangles, ordered and unordered lists, columns, barcodes, and imported PDF pages. It also provides helpers for spacing and explicit page breaks. Use the corresponding builder callback to configure an element, such as Text(..., text => ...) or Table(table => ...).
The examples show tested workflows, including tables, columns, images, barcodes, and merging PDFs.
Styling
Styles can be supplied at document, page, and element level. The repository examples demonstrate CSS strings passed to DocumentBuilder.Style(...) and PageBuilder.Style(...), as well as element classes and inline styles passed to Text(...).
DocumentBuilder.Create()
.Style("text { font-family: Helvetica; font-size: 18pt; color: navy; }")
.Pages(page => page
.Style(".emphasis { color: darkred; }")
.Text("Styled text", "emphasis"))
.Save("styled.pdf");
For cascading and inline-style examples, see Styling text using CSS. The examples document the supported styles used by Flow; do not assume every browser CSS feature is supported.