Package com.lowagie.text.pdf
Class PdfPageLabels
java.lang.Object
com.lowagie.text.pdf.PdfPageLabels
Page labels are used to identify each page visually on the screen or in print.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Logical pages will have the form 1,2,3,...static final int
No logical page numbers are generated but fixed text may still existstatic final int
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 final int
Logical pages will have the form i,ii,iii,iv,...private HashMap
<Integer, PdfDictionary> The sequence of logical pages.(package private) static PdfName[]
Dictionary values to set the logical page stylesstatic final int
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 final int
Logical pages will have the form I,II,III,IV,... -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPageLabel
(int page, int numberStyle) Adds or replaces a page label.void
addPageLabel
(int page, int numberStyle, String text) Adds or replaces a page label.void
addPageLabel
(int page, int numberStyle, String text, int firstPage) Adds or replaces a page label.void
Adds or replaces a page label.(package private) PdfDictionary
getDictionary
(PdfWriter writer) Gets the page label dictionary to insert into the document.static PdfPageLabels.PdfPageLabelFormat[]
getPageLabelFormats
(PdfReader reader) Retrieves the page labels from a PDF as an array ofPdfPageLabels.PdfPageLabelFormat
objects.static String[]
getPageLabels
(PdfReader reader) Retrieves the page labels from a PDF as an array of String objects.void
removePageLabel
(int page) Removes a page label.
-
Field Details
-
DECIMAL_ARABIC_NUMERALS
public static final int DECIMAL_ARABIC_NUMERALSLogical pages will have the form 1,2,3,...- See Also:
-
UPPERCASE_ROMAN_NUMERALS
public static final int UPPERCASE_ROMAN_NUMERALSLogical pages will have the form I,II,III,IV,...- See Also:
-
LOWERCASE_ROMAN_NUMERALS
public static final int LOWERCASE_ROMAN_NUMERALSLogical pages will have the form i,ii,iii,iv,...- See Also:
-
UPPERCASE_LETTERS
public static final int UPPERCASE_LETTERSLogical 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)- See Also:
-
LOWERCASE_LETTERS
public static final int LOWERCASE_LETTERSLogical 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)- See Also:
-
EMPTY
public static final int EMPTYNo logical page numbers are generated but fixed text may still exist- See Also:
-
numberingStyle
Dictionary values to set the logical page styles -
map
The sequence of logical pages. Will contain at least a value for page 1
-
-
Constructor Details
-
PdfPageLabels
public PdfPageLabels()Creates a new PdfPageLabel with a default logical page 1
-
-
Method Details
-
getPageLabels
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 or
null
if no page labels are present
-
getPageLabelFormats
Retrieves the page labels from a PDF as an array ofPdfPageLabels.PdfPageLabelFormat
objects.- Parameters:
reader
- a PdfReader object that has the page labels you want to retrieve- Returns:
- a PdfPageLabelEntry array, containing an entry for each format change or
null
if no page labels are present
-
addPageLabel
Adds or replaces a page label.- Parameters:
page
- the real page to start the numbering. First page is 1numberStyle
- the numbering style such as LOWERCASE_ROMAN_NUMERALStext
- the text to prefix the number. Can benull
or emptyfirstPage
- the first logical page number
-
addPageLabel
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 1numberStyle
- the numbering style such as LOWERCASE_ROMAN_NUMERALStext
- the text to prefix the number. Can benull
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 1numberStyle
- the numbering style such as LOWERCASE_ROMAN_NUMERALS
-
addPageLabel
Adds or replaces a page label.- Parameters:
format
- the PdfPageLabelFormat to add
-
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
-
getDictionary
Gets the page label dictionary to insert into the document.- Returns:
- the page label dictionary
-