Class PdfPageLabels

  • All Implemented Interfaces:
    java.util.Comparator

    public class PdfPageLabels
    extends java.lang.Object
    implements java.util.Comparator
    Page labels are used to identify each page visually on the screen or in print.
    • Field Summary

      Fields 
      Modifier and Type Field 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,...
      (package private) java.util.TreeMap map
      The sequence of logical pages.
      (package private) static PdfName[] numberingStyle
      Dictionary values to set the logical page styles
      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 Summary

      Constructors 
      Constructor Description
      PdfPageLabels()
      Creates a new PdfPageLabel with a default logical page 1
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPageLabel​(int page, int numberStyle)
      Adds or replaces a page label.
      void addPageLabel​(int page, int numberStyle, java.lang.String text)
      Adds or replaces a page label.
      void addPageLabel​(int page, int numberStyle, java.lang.String text, int firstPage)
      Adds or replaces a page label.
      int compare​(java.lang.Object obj, java.lang.Object obj1)
      Compares two Integer.
      boolean equals​(java.lang.Object obj)
      Not used
      PdfDictionary getDictionary()
      Gets the page label dictionary to insert into the document.
      void removePageLabel​(int page)
      Removes a page label.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Field Detail

      • DECIMAL_ARABIC_NUMERALS

        public static int DECIMAL_ARABIC_NUMERALS
        Logical pages will have the form 1,2,3,...
      • UPPERCASE_ROMAN_NUMERALS

        public static int UPPERCASE_ROMAN_NUMERALS
        Logical pages will have the form I,II,III,IV,...
      • LOWERCASE_ROMAN_NUMERALS

        public static int LOWERCASE_ROMAN_NUMERALS
        Logical pages will have the form i,ii,iii,iv,...
      • UPPERCASE_LETTERS

        public 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)
      • LOWERCASE_LETTERS

        public 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)
      • EMPTY

        public static int EMPTY
        No logical page numbers are generated but fixed text may still exist
      • numberingStyle

        static PdfName[] numberingStyle
        Dictionary values to set the logical page styles
      • map

        java.util.TreeMap map
        The sequence of logical pages. Will contain at least a value for page 1
    • Constructor Detail

      • PdfPageLabels

        public PdfPageLabels()
        Creates a new PdfPageLabel with a default logical page 1
    • Method Detail

      • compare

        public int compare​(java.lang.Object obj,
                           java.lang.Object obj1)
        Compares two Integer.
        Specified by:
        compare in interface java.util.Comparator
        Parameters:
        obj - the first Integer
        obj1 - the second Integer
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
      • equals

        public boolean equals​(java.lang.Object obj)
        Not used
        Specified by:
        equals in interface java.util.Comparator
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - not used
        Returns:
        always true
      • addPageLabel

        public void addPageLabel​(int page,
                                 int numberStyle,
                                 java.lang.String text,
                                 int firstPage)
        Adds or replaces a page label.
        Parameters:
        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
      • addPageLabel

        public void addPageLabel​(int page,
                                 int numberStyle,
                                 java.lang.String text)
        Adds or replaces a page label. The first logical page has the default of 1.
        Parameters:
        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
      • addPageLabel

        public void addPageLabel​(int page,
                                 int numberStyle)
        Adds or replaces a page label. There is no text prefix and the first logical page has the default of 1.
        Parameters:
        page - the real page to start the numbering. First page is 1
        numberStyle - the numbering style such as LOWERCASE_ROMAN_NUMERALS
      • removePageLabel

        public void removePageLabel​(int page)
        Removes a page label. The first page label can not be removed, only changed.
        Parameters:
        page - the real page to remove
      • getDictionary

        public PdfDictionary getDictionary()
        Gets the page label dictionary to insert into the document.
        Returns:
        the page label dictionary