PdfFlowContainer Class

A sequence of blocks of a flow document: headings, paragraphs, lists, images, tables, rules and spaces, laid out from top to bottom. PdfFlowDocument is the container of the pages; the cells of a table are containers too.

public class PdfFlowContainer

Methods

NameDescription
Heading(int, string)Adds a heading (H1 to H6), in the heading font, larger for the higher levels. It is kept on the page of the block that follows it, and added to the outline and the table of contents.
Image(PdfImage, string, double?)Adds an image (Figure), with its alternate description, which screen readers read.
List(IEnumerable<Action<PdfFlowContainer>>, bool)Adds a list (L) whose items hold blocks, such as paragraphs and nested lists.
List(IEnumerable<string>, bool)Adds a list (L) of items of text: each item (LI) has a label (Lbl), a bullet or its number, and a body (LBody).
Paragraph(Action<PdfInlineBuilder>, PdfParagraphStyle?)Adds a paragraph (P) of runs of text, each with its style, and links.
Paragraph(string, PdfParagraphStyle?)Adds a paragraph (P) of text in the style of the document.
Rule(PdfColor?, double)Adds a horizontal rule, an artifact.
Spacer(double)Adds an empty space.
Table(Action<PdfFlowTableBuilder>)Adds a table (Table): header rows (THead, TH), rows (TBody, TR, TD) and cells that hold blocks and span columns and rows.

Heading(int, string)

PdfFlowContainer.cs

Adds a heading (H1 to H6), in the heading font, larger for the higher levels. It is kept on the page of the block that follows it, and added to the outline and the table of contents.

public PdfFlowContainer Heading(int level, string text)

Parameters

level int
The level, from 1 to 6.
text string
The text.

Returns

PdfFlowContainer The container.

Exceptions

ArgumentOutOfRangeException
level is not between 1 and 6.

Image(PdfImage, string, double?)

PdfFlowContainer.cs

Adds an image (Figure), with its alternate description, which screen readers read.

public PdfFlowContainer Image(PdfImage image, string alternateDescription, double? width = null)

Parameters

image PdfImage
The image.
alternateDescription string
The description of the image.
width double?
The width of the image, in points, or null for the width of the container (smaller images keep their size of 1 point per pixel). The height keeps the ratio of the image, and the image is scaled down to fit a page.

Returns

PdfFlowContainer The container.

List overloads

List(IEnumerable<Action<PdfFlowContainer>>, bool)

PdfFlowContainer.cs

Adds a list (L) whose items hold blocks, such as paragraphs and nested lists.

public PdfFlowContainer List(IEnumerable<Action<PdfFlowContainer>> items, bool ordered = false)
Parameters
items IEnumerable<Action<PdfFlowContainer>>
The functions that add the blocks of each item.
ordered bool
Whether the items are numbered (1., 2., 3.) instead of bulleted.
Returns

PdfFlowContainer The container.

List(IEnumerable<string>, bool)

PdfFlowContainer.cs

Adds a list (L) of items of text: each item (LI) has a label (Lbl), a bullet or its number, and a body (LBody).

public PdfFlowContainer List(IEnumerable<string> items, bool ordered = false)
Parameters
items IEnumerable<string>
The texts of the items.
ordered bool
Whether the items are numbered (1., 2., 3.) instead of bulleted.
Returns

PdfFlowContainer The container.

Paragraph overloads

Paragraph(Action<PdfInlineBuilder>, PdfParagraphStyle?)

PdfFlowContainer.cs

Adds a paragraph (P) of runs of text, each with its style, and links.

public PdfFlowContainer Paragraph(Action<PdfInlineBuilder> build, PdfParagraphStyle? style = null)
Parameters
build Action<PdfInlineBuilder>
The function that adds the runs.
style PdfParagraphStyle?
The style of the paragraph, or null for the default.
Returns

PdfFlowContainer The container.

Paragraph(string, PdfParagraphStyle?)

PdfFlowContainer.cs

Adds a paragraph (P) of text in the style of the document.

public PdfFlowContainer Paragraph(string text, PdfParagraphStyle? style = null)
Parameters
text string
The text. A line feed breaks the line.
style PdfParagraphStyle?
The style of the paragraph, or null for the default.
Returns

PdfFlowContainer The container.

Rule(PdfColor?, double)

PdfFlowContainer.cs

Adds a horizontal rule, an artifact.

public PdfFlowContainer Rule(PdfColor? color = null, double width = 0.5d)

Parameters

color PdfColor?
The color of the rule, or null for gray.
width double
The width of the line, in points.

Returns

PdfFlowContainer The container.

Spacer(double)

PdfFlowContainer.cs

Adds an empty space.

public PdfFlowContainer Spacer(double height)

Parameters

height double
The height of the space, in points.

Returns

PdfFlowContainer The container.

Table(Action<PdfFlowTableBuilder>)

PdfFlowContainer.cs

Adds a table (Table): header rows (THead, TH), rows (TBody, TR, TD) and cells that hold blocks and span columns and rows.

Parameters

build Action<PdfFlowTableBuilder>
The function that adds the columns and the rows.

Returns

PdfFlowContainer The container.

Exceptions

ArgumentException
The table has no row, or its cells do not fit its columns.