Skip to main content

Page content and elements

Page content and elements

Flow adds page content through methods on PageBuilder. These calls are made inside the callback passed to DocumentBuilder.Pages(...); there is no separate PdfContent scope in the current API.

Element methods​

PageBuilder methodElement or operation
Text(string, ...)Adds text; an optional class and inline style or a TextElementBuilder callback can configure it.
Image(...)Adds an image, optionally configured through ImageElementBuilder.
Table(Action<TableBuilder>)Adds and configures a table.
Rectangle(Action<RectangleElementBuilder>)Adds a rectangle.
OrderedList(Action<OrderedListBuilder>) / UnorderedList(...)Adds a list and configures its items.
Columns(int, Action<ColumnsBuilder>)Creates a column layout.
LinearBarcode(...), Code128(...), Pdf417(...), QrCode(...), DataMatrix(...), Aztec(...)Adds a barcode of the selected type. String and byte-array overloads are available for selected barcode methods.
PdfPage(PdfSource, int, ...)Uses a page from a PDF as a page background.
PdfTemplate(string, int = 1)Uses a PDF file as a page template.
Spacing(...) / PageBreak()Adds spacing or an explicit page break to the page flow.

Configure text​

The generic text builder exposes methods including Color(...), FontFamily(...), FontSize(...), FontWeight(...), FontStyle(...), TextAlign(...)/Align(...), LineHeight(...), and TextDecoration(...). You can also apply a CSS class or inline style.

DocumentBuilder.Create()
.Pages(page => page
.Text("Centered heading", text => text
.FontFamily("Helvetica")
.FontSize(24)
.FontWeight(FontWeight.Bold)
.Align(TextAlign.Center)))
.Save("heading.pdf");

The method overloads and available enums are part of the Flow source and may evolve. For tested complete examples, see text, tables, images, lists, and barcodes.