class HexaPDF::Type::PageLabel

Parent

Represents a page label dictionary.

A page label dictionary contains information about the numbering style, the label prefix and the start number to construct page labels like ‘A-1’ or ‘iii’. What is not stored is the page to which it is applied since that is stored in a number tree referenced through the /PageLabels entry in the document catalog.

See HexaPDF::Document::Pages for details on how to create and manage page labels.

Examples:

  • numbering style :decimal, prefix none, start number default value

    1, 2, 3, 4, …

  • numbering style :lowercase_letters, prefix ‘Appendix ’, start number 5

    Appendix e, Appendix f, Appendix g, …

  • numbering style :uppercase_roman, prefix none, start number 10

    X, XI, XII, XIII, …

  • numbering style :none, prefix ‘Page’, start number default value

    Page, Page, Page, Page, …

  • numbering style :none, prefix none, start number default value

    “”, “”, “”, … (i.e. always the empty string)

See: PDF2.0 s12.4.2, HexaPDF::Document::Pages, HexaPDF::Type::Catalog

Field Definitions

NameType/Allowed ValuesRequiredDefault Value
TypeSymbolfalse:PageLabel
SSymbol
One of: :D, :R, :r, :A, :a
falsenil
PStringfalsenil
StIntegerfalse1

Public Instance Methods

construct_label(index)

Constructs the page label for the given index which needs to be relative to the page index of the first page in the associated labelling range.

This method is usually not called directly but through HexaPDF::Document::Pages#page_label.

numbering_style → numbering_style
numbering_style(value) → numbering_style

Returns the numbering style if no argument is given. Otherwise sets the numbering style to the given value.

The following numbering styles are available:

:none

No numbering is done; the label only consists of the prefix.

:decimal

Decimal arabic numerals (1, 2, 3, 4, …).

:uppercase_roman

Uppercase roman numerals (I, II, III, IV, …)

:lowercase_roman

Lowercase roman numerals (i, ii, iii, iv, …)

:uppercase_letters

Uppercase letters (A, B, C, D, …)

:lowercase_letters

Lowercase letters (a, b, c, d, …)

prefix → prefix
prefix(value) → prefix

Returns the label prefix if no argument is given. Otherwise sets the label prefix to the given string value.

start_number → start_number
start_number(value) → start_number

Returns the start number if no argument is given. Otherwise sets the start number to the given integer value.