Class Pages


public final class Pages extends PDFObject
A PDFObject that maintains the list of pages for the document. When a PDFDocument is created, it will create an instance of Pages and add it to the document catalog. You won't normally interact directly with this class.
  • Field Details

    • parent

      private final PDFDocument parent
      The PDF document.
    • pages

      private final List<Page> pages
    • fonts

      private final List<PDFFont> fonts
      The list of font objects used in the document.
    • fontMap

      private final Map<FontKey,PDFFont> fontMap
    • nextFont

      private int nextFont
    • fontMapper

      private final FontMapper fontMapper
  • Constructor Details

    • Pages

      public Pages(int number, int generation, PDFDocument parent)
      Creates a new Pages object.
      Parameters:
      number - the PDF object number.
      generation - the PDF object generation number.
      parent - the PDF document (null not permitted).
  • Method Details

    • getDocument

      public PDFDocument getDocument()
      Returns the PDF document that the pages belong to.
      Returns:
      The PDF document (never null).
    • getPages

      public List<Page> getPages()
      Returns a list of the pages in this object.
      Returns:
      A list of the pages.
    • getFonts

      public List<PDFFont> getFonts()
      Returns a list of fonts used in these pages.
      Returns:
      A list of fonts.
    • getFont

      public PDFFont getFont(String name)
      Returns the PDF font with the specified name, or null if there is no font with that name.
      Parameters:
      name - the font name.
      Returns:
      The PDF font or null.
    • add

      public void add(Page page)
      Adds a page to the collection.
      Parameters:
      page - the page.
    • findOrCreateFontReference

      public String findOrCreateFontReference(Font f)
      Finds or creates a font reference for the specified AWT font.
      Parameters:
      f - the font (null not permitted).
      Returns:
      The font reference.
    • createDictionary

      private Dictionary createDictionary()
    • getObjectBytes

      public byte[] getObjectBytes()
      Description copied from class: PDFObject
      Returns the bytes that go between the 'obj' and 'endobj' in the PDF output for this object.
      Specified by:
      getObjectBytes in class PDFObject
      Returns:
      A byte array.