public class PageLabel
extends java.lang.Object
Note:
There is no default numbering style; if no 'S' (Style) entry is present,
page labels consist solely of a label prefix with no numeric portion.
For example, if the 'P' entry (Prefix) specifies the label prefix
"Appendix", each page is simply labeled "Appendix" with no page number.
If the 'P' entry is also missing or empty, the page label is an empty
string.
Sample code (See PableLabelsTest sample project for examples):
// Create a page labeling scheme that starts with the first page in
// the document (page 1) and is using uppercase roman numbering
// style.
doc.SetPageLabel(1, PageLabel::Create(doc, PageLabel::e_roman_uppercase, "My Prefix ", 1));
// Create a page labeling scheme that starts with the fourth page in
// the document and is using decimal arabic numbering style.
// Also the numeric portion of the first label should start with number
// 4 (otherwise the first label would be "My Prefix 1").
PageLabel L2 = PageLabel::Create(doc, PageLabel::e_decimal, "My Prefix ", 4);
doc.SetPageLabel(4, L2);
// Create a page labeling scheme that starts with the seventh page in
// the document and is using alphabetic numbering style. The numeric
// portion of the first label should start with number 1.
PageLabel L3 = PageLabel::Create(doc, PageLabel::e_alphabetic_uppercase, "My Prefix ", 1);
doc.SetPageLabel(7, L3);
// Read page labels from an existing PDF document.
PageLabel label = new PageLabel();
for (int i=1; i<=doc.GetPageCount(); ++i) {
label = doc.GetPageLabel(i);
if (label.IsValid()) {
string title = label.GetLabelTitle(i);
}
}
Modifier and Type | Field and Description |
---|---|
static int |
e_alphabetic_lowercase
The Constant e_alphabetic_lowercase.
|
static int |
e_alphabetic_uppercase
The Constant e_alphabetic_uppercase.
|
static int |
e_decimal
The Constant e_decimal.
|
static int |
e_none
The Constant e_none.
|
static int |
e_roman_lowercase
The Constant e_roman_lowercase.
|
static int |
e_roman_uppercase
The Constant e_roman_uppercase.
|
Constructor and Description |
---|
PageLabel()
Create a default PageLabel.
|
PageLabel(Obj l)
Create a PageLabel and initialize it using given Cos/SDF object.
|
PageLabel(Obj l,
int first_page)
Instantiates a new page label and initialize it using given Cos/SDF object.
|
PageLabel(Obj l,
int first_page,
int last_page)
Instantiates a new page label and initialize it using given Cos/SDF object.
|
Modifier and Type | Method and Description |
---|---|
static PageLabel |
create(Doc doc,
int style)
Creates a new PageLabel in given document and in specified style
|
static PageLabel |
create(Doc doc,
int style,
java.lang.String prefix)
Creates a new PageLabel in given document and in specified style
|
static PageLabel |
create(Doc doc,
int style,
java.lang.String prefix,
int start_at)
Creates a new PageLabel in given document and in specified style
|
void |
destroy()
Frees the native memory of the object.
|
boolean |
equals(java.lang.Object d)
Compares two PageLabel-s for equality.
|
int |
getFirstPageNum()
Get the first page number.
|
java.lang.String |
getLabelTitle(int page_num)
Get the label title from given page
|
int |
getLastPageNum()
Get the last page number.
|
java.lang.String |
getPrefix()
Get the string prefix of PageLabel
|
Obj |
getSDFObj()
Get the SDFObj.
|
int |
getStart()
Get the start numeric value
|
int |
getStyle()
Get the page number style.
|
int |
hashCode() |
boolean |
isValid()
Checks if PageLabel is valid.
|
void |
setPrefix(java.lang.String prefix)
Set the String prefix to PageLabel
|
void |
setStart(int start_at)
Set the start numeric value
|
void |
setStyle(int style)
Set the numbering style for the label.
|
public static final int e_decimal
public static final int e_roman_uppercase
public static final int e_roman_lowercase
public static final int e_alphabetic_uppercase
public static final int e_alphabetic_lowercase
public static final int e_none
public PageLabel() throws PDFNetException
Note: The constructor does not copy any data, but is instead the logical equivalent of a type cast.
PDFNetException
public PageLabel(Obj l) throws PDFNetException
l
- the lPDFNetException
public PageLabel(Obj l, int first_page) throws PDFNetException
l
- the given Cos/SDF objectfirst_page
- first pagePDFNetException
public PageLabel(Obj l, int first_page, int last_page) throws PDFNetException
l
- the given Cos/SDF objectfirst_page
- first pagelast_page
- last pagePDFNetException
public static PageLabel create(Doc doc, int style) throws PDFNetException
doc
- A document to which the page label is added.style
- The numbering style for the label.PDFNetException
public static PageLabel create(Doc doc, int style, java.lang.String prefix) throws PDFNetException
doc
- A document to which the page label is added.style
- The numbering style for the label.prefix
- tring used to prefix the numeric portion of the page label.PDFNetException
public static PageLabel create(Doc doc, int style, java.lang.String prefix, int start_at) throws PDFNetException
doc
- A document to which the page label is added.style
- The numbering style for the label.prefix
- string used to prefix the numeric portion of the page label.start_at
- the value to use when generating the numeric portion of the first
label in this range; must be greater than or equal to 1.PDFNetException
public void destroy() throws PDFNetException
PDFNetException
public boolean equals(java.lang.Object d)
equals
in class java.lang.Object
d
- the other PageLabel objectpublic int hashCode()
hashCode
in class java.lang.Object
public boolean isValid() throws PDFNetException
PDFNetException
public java.lang.String getLabelTitle(int page_num) throws PDFNetException
page_num
- the input page numberPDFNetException
public void setStyle(int style) throws PDFNetException
Note: There is no default numbering style; if no 'S' (Style) entry is present, page labels consist solely of a label prefix with no numeric portion.
style
- the numbering style for the label.
You may use label style to customize the page numbering schemes
used throughout a document. There are three numbering formats:
- decimal (often used for normal page ranges)
- roman (often used for front matter such as a preface)
- alphabetic (often used for back matter such as appendices)PDFNetException
public int getStyle() throws PDFNetException
PDFNetException
public java.lang.String getPrefix() throws PDFNetException
PDFNetException
public void setPrefix(java.lang.String prefix) throws PDFNetException
prefix
- the string used to prefix the numeric portion of
the page label.PDFNetException
public int getStart() throws PDFNetException
PDFNetException
public void setStart(int start_at) throws PDFNetException
start_at
- the value to use when generating the numeric
portion of the first label in this range; must be greater than
or equal to 1.PDFNetException
public int getFirstPageNum() throws PDFNetException
PDFNetException
public int getLastPageNum() throws PDFNetException
PDFNetException
public Obj getSDFObj() throws PDFNetException
PDFNetException