setasign\SetaPDF2\Core\Document\Catalog

PageLabels Class for handling page labels

File: /SetaPDF v2/Core/Document/Catalog/PageLabels.php
Old class name (alias): \SetaPDF_Core_Document_Catalog_PageLabels

Class hierarchy

Summary

Constants

STYLE_DECIMAL_NUMERALS

public const string PageLabels::STYLE_DECIMAL_NUMERALS = 'D'

Style constant

Decimal arabic numerals

STYLE_LOWERCASE_LETTERS

public const string PageLabels::STYLE_LOWERCASE_LETTERS = 'a'

Style constant

Lowercase letters (a to z for the first 26 pages, aa to zz for the next 26, and so on)

STYLE_LOWERCASE_ROMAN_NUMERALS

public const string PageLabels::STYLE_LOWERCASE_ROMAN_NUMERALS = 'r'

Style constant

Lowercase roman numerals

STYLE_UPPERCASE_LETTERS

public const string PageLabels::STYLE_UPPERCASE_LETTERS = 'A'

Style constant

Uppercase letters (A to Z for the first 26 pages, AA to ZZ for the next 26, and so on)

STYLE_UPPERCASE_ROMAN_NUMERALS

public const string PageLabels::STYLE_UPPERCASE_ROMAN_NUMERALS = 'R'

Style constant

Uppercase roman numerals


Properties

$_catalog

The documents catalog instance

$_ranges

protected array PageLabels::$_ranges = array()

Label ranges

$_tree


Static Methods

integerToLetters()

public static PageLabels::integerToLetters (
int $integer,
bool $uppercase = true
): string

Converts an integer to a letter.

Parameters
$integer : int
 
$uppercase : bool
 

integerToRoman()

public static PageLabels::integerToRoman (
int $integer,
bool $uppercase = true
): string

Converts an integer to roman numerals.

Parameters
$integer : int
 
$uppercase : bool
 

Methods

__construct()

The constructor.

Parameters
$catalog : \SetaPDF_Core_Document_Catalog
 

_getRanges()

protected PageLabels::_getRanges (
void
): array

Get the page label ranges.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

_getTree()

protected PageLabels::_getTree (
bool $create = false
): ?\SetaPDF_Core_DataStructure_NumberTree

Get the tree page labels number tree object.

Parameters
$create : bool
 
Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

addRange()

public PageLabels::addRange (
int $startPage,
string $style = null,
string $prefix = '',
int $firstPageValue = 1,
string $encoding = 'UTF-8'
): void

Add a page label range.

Parameters
$startPage : int

The page index to start the page label range

$style : string

The page label style. See PageLabels::STYLE_XXX constants

$prefix : string

A page label prefix

$firstPageValue : int

The value of the numeric portion for the first page in the range

$encoding : string

The input encoding

Exceptions

Throws \setasign\SetaPDF2\Core\DataStructure\Tree\KeyAlreadyExistsException

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

cleanUp()

public PageLabels::cleanUp (
void
): void

Release memory / cycled references.

getDocument()

Get the document instance.

getPageLabelByPageNo()

public PageLabels::getPageLabelByPageNo (
int $pageNo,
string $encoding = 'UTF-8'
): string

Get the page label by a page number/index.

Parameters
$pageNo : int

The page number/index to get the page label for

$encoding : string

The output encoding

Return Values

Returns the page label for the specific page number/index

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getRange()

public PageLabels::getRange (
int $startPage,
string $encoding = 'UTF-8'
): ?array

Get a range by starting page number.

Parameters
$startPage : int
 
$encoding : string
 
Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getRanges()

public PageLabels::getRanges (
string $encoding = 'UTF-8'
): array

Ger all ranges.

Parameters
$encoding : string
 
Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

removeRange()

public PageLabels::removeRange (
int $startPage
): ?bool

Removes a range by the starting page number.

Parameters
$startPage : int
 
Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception