public class PdfPageLabels extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PdfPageLabels.PdfPageLabelFormat |
Modifier and Type | Field and Description |
---|---|
static int |
DECIMAL_ARABIC_NUMERALS
Logical pages will have the form 1,2,3,...
|
static int |
EMPTY
No logical page numbers are generated but fixed text may still exist
|
static 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)
|
static int |
LOWERCASE_ROMAN_NUMERALS
Logical pages will have the form i,ii,iii,iv,...
|
static 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)
|
static int |
UPPERCASE_ROMAN_NUMERALS
Logical pages will have the form I,II,III,IV,...
|
Constructor and Description |
---|
PdfPageLabels()
Creates a new PdfPageLabel with a default logical page 1
|
Modifier and Type | Method and Description |
---|---|
void |
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 |
addPageLabel(int page, int numberStyle, String text, int firstPage, boolean includeFirstPage)
Adds or replaces a page label.
|
void |
addPageLabel(PdfPageLabels.PdfPageLabelFormat format)
Adds or replaces a page label.
|
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 of PdfPageLabels.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.
|
public static final int DECIMAL_ARABIC_NUMERALS
public static final int UPPERCASE_ROMAN_NUMERALS
public static final int LOWERCASE_ROMAN_NUMERALS
public static final int UPPERCASE_LETTERS
public static final int LOWERCASE_LETTERS
public static final int EMPTY
public PdfPageLabels()
public void addPageLabel(int page, int numberStyle, String text, int firstPage)
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
public void addPageLabel(int page, int numberStyle, String text, int firstPage, boolean includeFirstPage)
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
includeFirstPage
- If true, the page label will be added to the first page if it is page 1. If the first page is 1 and this value is false, the value will not be added to the dictionary.
public void addPageLabel(int page, int numberStyle, String text)
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
public void addPageLabel(int page, int numberStyle)
page
- the real page to start the numbering. First page is 1
numberStyle
- the numbering style such as LOWERCASE_ROMAN_NUMERALS
public void addPageLabel(PdfPageLabels.PdfPageLabelFormat format)
public void removePageLabel(int page)
page
- the real page to remove
public PdfDictionary getDictionary(PdfWriter writer)
public static String[] getPageLabels(PdfReader reader)
reader
- a PdfReader object that has the page labels you want to retrieve
null
if no page labels are present
public static PdfPageLabels.PdfPageLabelFormat[] getPageLabelFormats(PdfReader reader)
PdfPageLabels.PdfPageLabelFormat
objects.
reader
- a PdfReader object that has the page labels you want to retrieve
null
if no page labels are present
Copyright © 1998–2022. All rights reserved.