Click or drag to resize

Get access, create and manipulate page labels

This topic contains the following sections:


Each page in a PDF document is identified by an integer page index that expresses the page’s relative position within the document. In addition, a document may optionally define page labels to identify each page visually on the screen or in print. Page labels and page indices need not coincide: the indices are fixed, running consecutively through the document starting from 0 for the first page, but the labels can be specified in any way that is appropriate for the particular document. For example, if the document begins with 12 pages of front matter numbered in roman numerals and the remainder of the document is numbered in arabic, the first page would have a page index of 0 and a page label of i, the twelfth page would have index 11 and label xii, and the thirteenth page would have index 12 and label 1.

For purposes of page labeling, a document can be divided into labeling ranges, each of which is a series of consecutive pages using the same numbering system. Pages within a range are numbered sequentially in ascending order. A page’s label consists of a numeric portion based on its position within its labeling range, optionally preceded by a label prefix denoting the range itself. For example, the pages in an appendix might be labeled with decimal numeric portions prefixed with the string A−; the resulting page labels would be A−1, A−2, and so on.

Open in full size

Page Labels

A document’s labeling ranges are defined by the PdfDocumentLabels property. The value of this property is the PdfLabelingRanges dictionary, each of whose keys is the page index of the first page in a labeling range. The corresponding value is the PdfLabel class defining the labeling characteristics for the pages in that range. The dictionary must include a value for page index 0.

Adding page labels to a PDF document

The below example illustrates a document with pages labeled

i, ii, iii, iv, 1, 2, 3, A-8, A-9, ...

using (var doc = PdfDocument.Load("sample.pdf"))

    doc.Labels = new PdfLabelingRanges(doc)
        { 0, new PdfLabel(NumberStyle.RomanLowercase) },
        { 4, new PdfLabel(NumberStyle.Decimal) },
        { 7, new PdfLabel(NumberStyle.Decimal, "A-", 8) }

    //Save a copy of PDF document
    doc.Save("sample_modified.pdf", SaveFlags.NoIncremental);
See Also