PdfHeaderFooterOptions Class

The headers and footers PdfDocument.AddHeaderFooter stamps on the pages: up to three texts at the top of each page and three at the bottom, on the left, in the center and on the right.

public sealed class PdfHeaderFooterOptions

Remarks

A text is a template whose tokens are replaced for each page: {page} (the number of the page, from PdfHeaderFooterOptions.StartPageNumber), {pages} (the number of pages, or PdfHeaderFooterOptions.PageCount), {label} (the page label, or the number of the page when the document has none), {date} (PdfHeaderFooterOptions.Date in PdfHeaderFooterOptions.DateFormat) and {bates} (the Bates number of the page, PdfHeaderFooterOptions.Bates). {{ and }} are braces.

The date is never the current date implicitly: the output of the library depends only on the document and the options.

Constructors

NameDescription
PdfHeaderFooterOptions()

PdfHeaderFooterOptions()

PdfHeaderFooterOptions.cs
public PdfHeaderFooterOptions()

No documentation is available.

Properties

NameDescription
BatesGets the Bates numbering {bates} gives, or null when the texts have no Bates number.
ColorGets the color of the text. The default is black.
DateGets the date {date} gives, or null when the texts have no date.
DateFormatGets the format of {date}, with the invariant culture. The default is yyyy-MM-dd.
FirstPageIndexGets the index of the first page stamped. The default is 0.
FontGets the font, or null for Helvetica. The standard 14 fonts only show the characters of WinAnsiEncoding.
FontSizeGets the font size, in points. The default is 10.
FooterCenterGets the text in the center of the footer, or null for none.
FooterLeftGets the text on the left of the footer, or null for none.
FooterRightGets the text on the right of the footer, or null for none.
HeaderCenterGets the text in the center of the header, or null for none.
HeaderLeftGets the text on the left of the header, or null for none.
HeaderRightGets the text on the right of the header, or null for none.
LastPageIndexGets the index of the last page stamped, or null (the default) for the last page of the document.
MarginGets the distance, in points, between the texts and the edges of the page as it is displayed. The default is 36 (half an inch).
PageCountGets the number of pages {pages} gives, or null (the default) for the number of pages of the document.
PlacementGets where the texts are painted: over the content of the page (the default) or under it.
StartPageNumberGets the number of the first page, for {page}. The default is 1.

Gets the Bates numbering {bates} gives, or null when the texts have no Bates number.

public PdfBatesNumbering? Bates { get; init; }

Property value

PdfBatesNumbering?

Gets the color of the text. The default is black.

public PdfColor Color { get; init; }

Property value

PdfColor

Gets the date {date} gives, or null when the texts have no date.

public DateTimeOffset? Date { get; init; }

Property value

DateTimeOffset?

Gets the format of {date}, with the invariant culture. The default is yyyy-MM-dd.

public string DateFormat { get; init; }

Property value

string

Gets the index of the first page stamped. The default is 0.

public int FirstPageIndex { get; init; }

Property value

int

Exceptions

ArgumentOutOfRangeException
The value is negative.

Gets the font, or null for Helvetica. The standard 14 fonts only show the characters of WinAnsiEncoding.

public PdfFont? Font { get; init; }

Property value

PdfFont?

Gets the font size, in points. The default is 10.

public double FontSize { get; init; }

Property value

double

Exceptions

ArgumentOutOfRangeException
The value is not a positive number.

Gets the text in the center of the footer, or null for none.

public string? FooterCenter { get; init; }

Property value

string?

Gets the text on the left of the footer, or null for none.

public string? FooterLeft { get; init; }

Property value

string?

Gets the text on the right of the footer, or null for none.

public string? FooterRight { get; init; }

Property value

string?

Gets the text in the center of the header, or null for none.

public string? HeaderCenter { get; init; }

Property value

string?

Gets the text on the left of the header, or null for none.

public string? HeaderLeft { get; init; }

Property value

string?

Gets the text on the right of the header, or null for none.

public string? HeaderRight { get; init; }

Property value

string?

Gets the index of the last page stamped, or null (the default) for the last page of the document.

public int? LastPageIndex { get; init; }

Property value

int?

Gets the distance, in points, between the texts and the edges of the page as it is displayed. The default is 36 (half an inch).

public double Margin { get; init; }

Property value

double

Exceptions

ArgumentOutOfRangeException
The value is negative.

Gets the number of pages {pages} gives, or null (the default) for the number of pages of the document.

public int? PageCount { get; init; }

Property value

int?

Gets where the texts are painted: over the content of the page (the default) or under it.

public PdfContentPlacement Placement { get; init; }

Property value

PdfContentPlacement

Gets the number of the first page, for {page}. The default is 1.

public int StartPageNumber { get; init; }

Property value

int