Class PdfXrefTable

java.lang.Object
com.itextpdf.kernel.pdf.PdfXrefTable

public class PdfXrefTable extends Object
A representation of a cross-referenced table of a PDF document.
  • Constructor Details

    • PdfXrefTable

      public PdfXrefTable()
      Creates a PdfXrefTable which will be used to store xref structure of the pdf document. Capacity and MemoryLimitsAwareHandler instance would be set by default values.
    • PdfXrefTable

      public PdfXrefTable (int capacity)
      Creates a PdfXrefTable which will be used to store xref structure of the pdf document.
      Parameters:
      capacity - initial capacity of xref table.
    • PdfXrefTable

      public PdfXrefTable (MemoryLimitsAwareHandler memoryLimitsAwareHandler)
      Creates a PdfXrefTable which will be used to store xref structure of the pdf document.
      Parameters:
      memoryLimitsAwareHandler - custom MemoryLimitsAwareHandler to set.
    • PdfXrefTable

      public PdfXrefTable (int capacity, MemoryLimitsAwareHandler memoryLimitsAwareHandler)
      Creates a PdfXrefTable which will be used to store xref structure of the pdf document.
      Parameters:
      capacity - initial capacity of xref table.
      memoryLimitsAwareHandler - memoryLimitsAwareHandler custom MemoryLimitsAwareHandler to set.
  • Method Details

    • setMemoryLimitsAwareHandler

      public void setMemoryLimitsAwareHandler (MemoryLimitsAwareHandler memoryLimitsAwareHandler)
      Parameters:
      memoryLimitsAwareHandler - instance to set.
    • add

      public PdfIndirectReference add (PdfIndirectReference reference)
      Adds indirect reference to list of indirect objects.
      Parameters:
      reference - indirect reference to add.
      Returns:
      reference from param
    • size

      public int size()
      Get size of cross-reference table.
      Returns:
      amount of lines including zero-object
    • getCountOfIndirectObjects

      public int getCountOfIndirectObjects()
      Calculates a number of stored references to indirect objects.
      Returns:
      number of indirect objects
    • get

      public PdfIndirectReference get (int index)
      Get appropriate reference to indirect object.
      Parameters:
      index - is the index of required object
      Returns:
      reference to object with the provided index
    • writeKeyInfo

      protected static void writeKeyInfo (PdfDocument document)
      Convenience method to write the fingerprint preceding the trailer. The fingerprint contains information on iText products used in the generation or manipulation of an outputted PDF file.
      Parameters:
      document - pdfDocument to write the fingerprint to
    • createNextIndirectReference

      protected PdfIndirectReference createNextIndirectReference (PdfDocument document)
      Creates next available indirect reference.
      Parameters:
      document - is the current document
      Returns:
      created indirect reference.
    • freeReference

      protected void freeReference (PdfIndirectReference reference)
      Set the reference to free state.
      Parameters:
      reference - is a reference to be updated.
    • getCapacity

      protected int getCapacity()
      Gets the capacity of xref stream.
      Returns:
      the capacity of xref stream.
    • setCapacity

      protected void setCapacity (int capacity)
      Increase capacity of the array of indirect references.
      Parameters:
      capacity - is a new capacity to set
    • writeXrefTableAndTrailer

      protected void writeXrefTableAndTrailer (PdfDocument document, PdfObject fileId, PdfObject crypto) throws IOException
      Writes cross reference table and trailer to PDF.
      Parameters:
      document - is the current document
      fileId - field id
      crypto - pdf encryption
      Throws:
      IOException - if any I/O error occurs