- java.lang.Object
-
- com.itextpdf.text.pdf.PdfPageLabels
-
public class PdfPageLabels extends java.lang.ObjectPage labels are used to identify each page visually on the screen or in print.- Author:
- Paulo Soares (psoares@consiste.pt)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPdfPageLabels.PdfPageLabelFormat
-
Field Summary
Fields Modifier and Type Field Description static intDECIMAL_ARABIC_NUMERALSLogical pages will have the form 1,2,3,...static intEMPTYNo logical page numbers are generated but fixed text may still existstatic intLOWERCASE_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)static intLOWERCASE_ROMAN_NUMERALSLogical pages will have the form i,ii,iii,iv,...static intUPPERCASE_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)static intUPPERCASE_ROMAN_NUMERALSLogical pages will have the form I,II,III,IV,...
-
Constructor Summary
Constructors Constructor Description PdfPageLabels()Creates a new PdfPageLabel with a default logical page 1
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPageLabel(int page, int numberStyle)Adds or replaces a page label.voidaddPageLabel(int page, int numberStyle, java.lang.String text)Adds or replaces a page label.voidaddPageLabel(int page, int numberStyle, java.lang.String text, int firstPage)Adds or replaces a page label.voidaddPageLabel(PdfPageLabels.PdfPageLabelFormat format)Adds or replaces a page label.static PdfPageLabels.PdfPageLabelFormat[]getPageLabelFormats(PdfReader reader)Retrieves the page labels from a PDF as an array ofPdfPageLabels.PdfPageLabelFormatobjects.static java.lang.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,...- See Also:
- Constant Field Values
-
UPPERCASE_ROMAN_NUMERALS
public static final int UPPERCASE_ROMAN_NUMERALS
Logical pages will have the form I,II,III,IV,...- See Also:
- Constant Field Values
-
LOWERCASE_ROMAN_NUMERALS
public static final int LOWERCASE_ROMAN_NUMERALS
Logical pages will have the form i,ii,iii,iv,...- See Also:
- Constant Field Values
-
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)- See Also:
- Constant Field Values
-
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)- See Also:
- Constant Field Values
-
EMPTY
public static final int EMPTY
No logical page numbers are generated but fixed text may still exist- See Also:
- Constant Field Values
-
-
Method Detail
-
addPageLabel
public void addPageLabel(int page, int numberStyle, java.lang.String text, int firstPage)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 benullor emptyfirstPage- the first logical page number
-
addPageLabel
public void addPageLabel(int page, int numberStyle, java.lang.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 1numberStyle- the numbering style such as LOWERCASE_ROMAN_NUMERALStext- the text to prefix the number. Can benullor 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
public void addPageLabel(PdfPageLabels.PdfPageLabelFormat format)
Adds or replaces a page label.
-
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
-
getPageLabels
public static java.lang.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 or
nullif no page labels are present
-
getPageLabelFormats
public static PdfPageLabels.PdfPageLabelFormat[] getPageLabelFormats(PdfReader reader)
Retrieves the page labels from a PDF as an array ofPdfPageLabels.PdfPageLabelFormatobjects.- 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
nullif no page labels are present
-
-