Home » pdfbox-1.1.0-src » org.apache.pdfbox.pdmodel.common » [javadoc | source]
org.apache.pdfbox.pdmodel.common
public class: PDPageLabels [javadoc | source]
java.lang.Object
   org.apache.pdfbox.pdmodel.common.PDPageLabels

All Implemented Interfaces:
    COSObjectable

Represents the page label dictionary of a document.
Constructor:
 public PDPageLabels(PDDocument document) 
    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) .

    Parameters:
    document - The document the page label dictionary is created for.
    Also see:
    PDDocumentCatalog#setPageLabels(PDPageLabels)
 public PDPageLabels(PDDocument document,
    COSDictionary dict) throws IOException 
    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:
    document - The document the page label dictionary is created for.
    dict - an existing page label dictionary
    Throws:
    IOException - If something goes wrong during the number tree conversion.
    Also see:
    PDDocumentCatalog#setPageLabels(PDPageLabels)
Method from org.apache.pdfbox.pdmodel.common.PDPageLabels Summary:
getCOSObject,   getLabelsByPageIndices,   getPageIndicesByLabels,   getPageLabelRange,   getPageRangeCount,   setLabelItem
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.pdfbox.pdmodel.common.PDPageLabels Detail:
 public COSBase getCOSObject() 
 public String[] getLabelsByPageIndices() 
    Returns a mapping with 0-based page indices as keys and corresponding page labels as values as an array. The array will have exactly as much entries as the document has pages.
 public Map<String, Integer> getPageIndicesByLabels() 
    Returns a mapping with computed page labels as keys and corresponding 0-based page indices as values. The returned map will contain at most as much entries as the document has pages.

    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 PDPageLabelRange getPageLabelRange(int startPage) 
    Returns the page label range starting at the given page, or {@code null} if no such range is defined.
 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).

 public  void setLabelItem(int startPage,
    PDPageLabelRange item) 
    Sets the page label range beginning at the specified start page.