Class PDFStructElem

All Implemented Interfaces:
Serializable, StructureTreeElement, PDFWritable
Direct Known Subclasses:
PageSequenceStructElem, PDFStructElem.Placeholder

public class PDFStructElem extends StructureHierarchyMember implements StructureTreeElement, Serializable
Class representing a PDF Structure Element.
See Also:
  • Field Details

    • parentElement

      protected PDFStructElem parentElement
    • kids

      protected List<PDFObject> kids
      Elements to be added to the kids array.
  • Constructor Details

    • PDFStructElem

      public PDFStructElem()
      Creates PDFStructElem with no entries.
    • PDFStructElem

      public PDFStructElem(PDFObject parent, StructureType structureType)
      Creates a new structure element.
      Parameters:
      parent - parent of this element
      structureType - the structure type of this element
  • Method Details

    • getParentStructElem

      public PDFStructElem getParentStructElem()
      Returns the parent of this structure element.
      Returns:
      the parent, null if the parent is not a structure element (i.e., is the structure tree root)
    • setParent

      public void setParent(PDFObject parent)
      Sets the direct parent object.
      Overrides:
      setParent in class PDFObject
      Parameters:
      parent - the direct parent
    • addKid

      public void addKid(PDFObject kid)
      Adds a kid to this structure element.
      Specified by:
      addKid in class StructureHierarchyMember
      Parameters:
      kid - element to be added
    • setMCIDKid

      public void setMCIDKid(int mcid)
      Sets the given mcid as the kid of this structure element. This element will then add itself to its parent structure element if it has not already, and so will the parent, and so on.
      Parameters:
      mcid - mcid of the marked-content sequence corresponding to this structure element's kid
    • setPage

      public void setPage(PDFPage page)
      Sets the page reference of this structure element.
      Parameters:
      page - value for the Pg entry
    • getStructureType

      public StructureType getStructureType()
      Returns the structure type of this structure element.
      Returns:
      the value of the S entry
    • setLanguage

      public void setLanguage(Locale language)
      Sets the language of this structure element.
      Parameters:
      language - a value for the Lang entry
    • getLanguage

      public String getLanguage()
      Returns the language of this structure element.
      Returns:
      the value of the Lang entry (null if no language was specified)
    • writeDictionary

      protected void writeDictionary(OutputStream out, StringBuilder textBuffer) throws IOException
      Description copied from class: PDFDictionary
      Writes the contents of the dictionary to a StringBuffer.
      Overrides:
      writeDictionary in class PDFDictionary
      Parameters:
      out - the OutputStream (for binary content)
      textBuffer - the text buffer for text output
      Throws:
      IOException - if an I/O error occurs
    • addKidInSpecificOrder

      public void addKidInSpecificOrder(int position, PDFStructElem kid)
    • attachKids

      protected boolean attachKids()
      Attaches all valid kids to the kids array.
      Returns:
      true iff 1+ kids were added to the kids array
    • setTableAttributeColSpan

      public void setTableAttributeColSpan(int colSpan)
    • setTableAttributeRowSpan

      public void setTableAttributeRowSpan(int rowSpan)
    • getKids

      public List<PDFObject> getKids()
    • output

      public int output(OutputStream stream) throws IOException
      Description copied from class: PDFDictionary
      Write the PDF represention of this object
      Overrides:
      output in class PDFDictionary
      Parameters:
      stream - the stream to write the PDF to
      Returns:
      the number of bytes written
      Throws:
      IOException - if there is an error writing to the stream
    • getObjectNumber

      PDFObjectNumber getObjectNumber()
      Returns the object number of this indirect object. Note that a compressed object must have a generation number of 0.
      Returns:
      the object number.