org.apache.fop.pdf

## Class PDFStructElem

- java.lang.Object
- - org.apache.fop.pdf.PDFObject
  - - org.apache.fop.pdf.PDFDictionary
    - - org.apache.fop.pdf.StructureHierarchyMember
      - - org.apache.fop.pdf.PDFStructElem

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

      public class PDFStructElem
      extends StructureHierarchyMember
      implements StructureTreeElement

  Class representing a PDF Structure Element.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `PDFStructElem.Placeholder` Class representing a placeholder for a PDF Structure Element.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<PDFObject>` | `kids` Elements to be added to the kids array.
    `protected PDFStructElem` | `parentElement`

    - ### Fields inherited from class org.apache.fop.pdf.PDFDictionary

      `entries, order`

    - ### Fields inherited from class org.apache.fop.pdf.PDFObject

      `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFStructElem(PDFObject parent, StructureType structureType)` Creates a new structure element.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addKid(PDFObject kid)` Adds a kid to this structure element.
    `protected boolean` | `attachKids()` Attaches all valid kids to the kids array.
    `java.lang.String` | `getLanguage()` Returns the language of this structure element.
    `PDFObjectNumber` | `getObjectNumber()` Returns the object number of this indirect object.
    `PDFStructElem` | `getParentStructElem()` Returns the parent of this structure element.
    `StructureType` | `getStructureType()` Returns the structure type of this structure element.
    `int` | `output(java.io.OutputStream outputStream)` Outputs this object's content into the given stream.
    `void` | `setLanguage(java.util.Locale language)` Sets the language of this structure element.
    `void` | `setMCIDKid(int mcid)` Sets the given mcid as the kid of this structure element.
    `void` | `setPage(PDFPage page)` Sets the page reference of this structure element.
    `void` | `setParent(PDFObject parent)` Sets the direct parent object.
    `void` | `setTableAttributeColSpan(int colSpan)`
    `void` | `setTableAttributeRowSpan(int rowSpan)`
    `protected void` | `writeDictionary(java.io.OutputStream out, java.lang.StringBuilder textBuffer)` Writes the contents of the dictionary to a StringBuffer.

    - ### Methods inherited from class org.apache.fop.pdf.PDFDictionary

      `get, getChildren, getChildren, output, put, put`

    - ### Methods inherited from class org.apache.fop.pdf.PDFObject

      `contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, toPDF, toPDFString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### parentElement

          protected PDFStructElem parentElement

    - #### kids

          protected java.util.List<PDFObject> kids

      Elements to be added to the kids array.

  - ### Constructor Detail

    - #### 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 Detail

    - #### 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(java.util.Locale language)

      Sets the language of this structure element.
      Parameters:
        `language` - a value for the Lang entry

    - #### getLanguage

          public java.lang.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(java.io.OutputStream out,
                                         java.lang.StringBuilder textBuffer)
                                  throws java.io.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:
        `java.io.IOException` - if an I/O error occurs

    - #### 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)

    - #### getObjectNumber

          public 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.

    - #### output

          public int output(java.io.OutputStream outputStream)
                     throws java.io.IOException

      Outputs this object's content into the given stream.
      Parameters:
        `outputStream` - a stream, likely to be provided by the containing object stream
      Returns:
        the number of bytes written to the stream
      Throws:
        `java.io.IOException`

Copyright 1999-2015 The Apache Software Foundation. All Rights Reserved.