|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pdfbox.pdmodel.common.PDPageLabels
public class PDPageLabels
Represents the page label dictionary of a document.
Constructor Summary | |
---|---|
PDPageLabels(PDDocument document)
Creates an empty page label dictionary for the given document. |
|
PDPageLabels(PDDocument document,
COSDictionary dict)
Creates an page label dictionary for a document using the information in the given COS dictionary. |
Method Summary | |
---|---|
COSBase |
getCOSObject()
Convert this standard java object to a COS object. |
String[] |
getLabelsByPageIndices()
Returns a mapping with 0-based page indices as keys and corresponding page labels as values as an array. |
Map<String,Integer> |
getPageIndicesByLabels()
Returns a mapping with computed page labels as keys and corresponding 0-based page indices as values. |
PDPageLabelRange |
getPageLabelRange(int startPage)
Returns the page label range starting at the given page, or null
if no such range is defined. |
int |
getPageRangeCount()
Returns the number of page label ranges. |
void |
setLabelItem(int startPage,
PDPageLabelRange item)
Sets the page label range beginning at the specified start page. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PDPageLabels(PDDocument document)
Note that the page label dictionary won't be automatically added to the
document; you will still need to do it manually (see
PDDocumentCatalog#setPageLabels(PDPageLabels)
.
document
- The document the page label dictionary is created for.PDDocumentCatalog#setPageLabels(PDPageLabels)
public PDPageLabels(PDDocument document, COSDictionary dict) throws IOException
Note that the page label dictionary won't be automatically added to the
document; you will still need to do it manually (see
PDDocumentCatalog#setPageLabels(PDPageLabels)
.
document
- The document the page label dictionary is created for.dict
- an existing page label dictionary
IOException
- If something goes wrong during the number tree conversion.PDDocumentCatalog#setPageLabels(PDPageLabels)
Method Detail |
---|
public int getPageRangeCount()
This will be always >= 1, as the required default entry for the page range starting at the first page is added automatically by this implementation (see PDF32000-1:2008, p. 375).
public PDPageLabelRange getPageLabelRange(int startPage)
null
if no such range is defined.
startPage
- the 0-based page index representing the start page of the page
range the item is defined for.
null
if no label range is defined
for the given start page.public void setLabelItem(int startPage, PDPageLabelRange item)
startPage
- the 0-based index of the page representing the start of the
page label range.item
- the page label item to set.public COSBase getCOSObject()
COSObjectable
getCOSObject
in interface COSObjectable
public Map<String,Integer> getPageIndicesByLabels()
NOTE: If the document contains duplicate page labels, the returned map will contain less entries than the document has pages. The page index returned in this case is the highest index among all pages sharing the same label.
public String[] getLabelsByPageIndices()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |