com.lowagie.text.pdf

Class PdfPageLabels

public class PdfPageLabels extends Object

Page labels are used to identify each page visually on the screen or in print.

Author: Paulo Soares (psoares@consiste.pt)

Field Summary
static intDECIMAL_ARABIC_NUMERALS
Logical pages will have the form 1,2,3,...
static intEMPTY
No logical page numbers are generated but fixed text may still exist
static intLOWERCASE_LETTERS
Logical pages will have the form of uppercase letters (a to z for the first 26 pages, aa to zz for the next 26, and so on)
static intLOWERCASE_ROMAN_NUMERALS
Logical pages will have the form i,ii,iii,iv,...
TreeMapmap
The sequence of logical pages.
static PdfName[]numberingStyle
Dictionary values to set the logical page styles
static intUPPERCASE_LETTERS
Logical pages will have the form of uppercase letters (A to Z for the first 26 pages, AA to ZZ for the next 26, and so on)
static intUPPERCASE_ROMAN_NUMERALS
Logical pages will have the form I,II,III,IV,...
Constructor Summary
PdfPageLabels()
Creates a new PdfPageLabel with a default logical page 1
Method Summary
voidaddPageLabel(int page, int numberStyle, String text, int firstPage)
Adds or replaces a page label.
voidaddPageLabel(int page, int numberStyle, String text)
Adds or replaces a page label.
voidaddPageLabel(int page, int numberStyle)
Adds or replaces a page label.
PdfDictionarygetDictionary()
Gets the page label dictionary to insert into the document.
static String[]getPageLabels(PdfReader reader)
Retrieves the page labels from a PDF as an array of String objects.
voidremovePageLabel(int page)
Removes a page label.

Field Detail

DECIMAL_ARABIC_NUMERALS

public static final int DECIMAL_ARABIC_NUMERALS
Logical pages will have the form 1,2,3,...

EMPTY

public static final int EMPTY
No logical page numbers are generated but fixed text may still exist

LOWERCASE_LETTERS

public static final int LOWERCASE_LETTERS
Logical pages will have the form of uppercase letters (a to z for the first 26 pages, aa to zz for the next 26, and so on)

LOWERCASE_ROMAN_NUMERALS

public static final int LOWERCASE_ROMAN_NUMERALS
Logical pages will have the form i,ii,iii,iv,...

map

TreeMap map
The sequence of logical pages. Will contain at least a value for page 1

numberingStyle

static PdfName[] numberingStyle
Dictionary values to set the logical page styles

UPPERCASE_LETTERS

public static final int UPPERCASE_LETTERS
Logical pages will have the form of uppercase letters (A to Z for the first 26 pages, AA to ZZ for the next 26, and so on)

UPPERCASE_ROMAN_NUMERALS

public static final int UPPERCASE_ROMAN_NUMERALS
Logical pages will have the form I,II,III,IV,...

Constructor Detail

PdfPageLabels

public PdfPageLabels()
Creates a new PdfPageLabel with a default logical page 1

Method Detail

addPageLabel

public void addPageLabel(int page, int numberStyle, String text, int firstPage)
Adds or replaces a page label.

Parameters: page the real page to start the numbering. First page is 1 numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS text the text to prefix the number. Can be null or empty firstPage the first logical page number

addPageLabel

public void addPageLabel(int page, int numberStyle, String text)
Adds or replaces a page label. The first logical page has the default of 1.

Parameters: page the real page to start the numbering. First page is 1 numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS text the text to prefix the number. Can be null or empty

addPageLabel

public void addPageLabel(int page, int numberStyle)
Adds or replaces a page label. There is no text prefix and the first logical page has the default of 1.

Parameters: page the real page to start the numbering. First page is 1 numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS

getDictionary

PdfDictionary getDictionary()
Gets the page label dictionary to insert into the document.

Returns: the page label dictionary

getPageLabels

public static String[] getPageLabels(PdfReader reader)
Retrieves the page labels from a PDF as an array of String objects.

Parameters: reader a PdfReader object that has the page labels you want to retrieve

Returns: a String array

removePageLabel

public void removePageLabel(int page)
Removes a page label. The first page label can not be removed, only changed.

Parameters: page the real page to remove