java.lang.Object
org.sejda.sambox.pdmodel.common.PDPageLabels
- All Implemented Interfaces:
COSObjectable
Represents the page label dictionary of a document.
- Author:
- Igor Podolskiy
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty page label dictionary for the given document.PDPageLabels(COSDictionary dict) Creates an page label dictionary for a document using the information in the given COS dictionary. -
Method Summary
Modifier and TypeMethodDescriptiongetPageLabelRange(int startPage) Returns the page label range starting at the given page, ornullif no such range is defined.intReturns the number of page label ranges.voidsetLabelItem(int startPage, PDPageLabelRange item) Sets the page label range beginning at the specified start page.
-
Constructor Details
-
PDPageLabels
public PDPageLabels()Creates an empty page label dictionary for the given 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). -
PDPageLabels
Creates an page label dictionary for a document using the information in the given COS dictionary.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).- Parameters:
dict- an existing page label dictionary- Throws:
IOException- If something goes wrong during the number tree conversion.- See Also:
-
-
Method Details
-
getPageRangeCount
public int getPageRangeCount()Returns the number of page label ranges.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).
- Returns:
- the number of page label ranges.
-
getPageLabelRange
Returns the page label range starting at the given page, ornullif no such range is defined.- Parameters:
startPage- the 0-based page index representing the start page of the page range the item is defined for.- Returns:
- the page label range or
nullif no label range is defined for the given start page.
-
setLabelItem
Sets the page label range beginning at the specified start page.- Parameters:
startPage- the 0-based index of the page representing the start of the page label range.item- the page label item to set.- Throws:
IllegalArgumentException- if the startPage parameter is < 0.
-
getLabels
-
getCOSObject
- Specified by:
getCOSObjectin interfaceCOSObjectable- Returns:
- The
COSBasethat matches this Java object.
-