org.apache.fop.afp.modca

## Class Document

- java.lang.Object
- - org.apache.fop.afp.modca.AbstractAFPObject
  - - org.apache.fop.afp.modca.AbstractStructuredObject
    - - org.apache.fop.afp.modca.AbstractTripletStructuredObject
      - - org.apache.fop.afp.modca.AbstractNamedAFPObject
        - - org.apache.fop.afp.modca.AbstractPageObject
          - - org.apache.fop.afp.modca.AbstractResourceGroupContainer
            - - org.apache.fop.afp.modca.AbstractResourceEnvironmentGroupContainer
              - - org.apache.fop.afp.modca.Document

- All Implemented Interfaces:
    Completable, Streamable

      public final class Document
      extends AbstractResourceEnvironmentGroupContainer

  The document is the highest level of the MO:DCA data-stream document component hierarchy. Documents can be made up of pages, and the pages, which are at the intermediate level, can be made up of objects. Objects are at the lowest level, and can be bar codes, graphics, images, and presentation text. At each level of the hierarchy certain sets of MO:DCA data structures, called structured fields, are permissible. The document, pages and objects are bounded by structured fields that define their beginnings and their ends. These structured fields, called begin-end pairs, provide an envelope for the data-stream components. This feature enables a processor of the data stream that is not fully compliant with the architecture to bypass those objects that are beyond its scope, and to process the data stream to the best of its abilities. A presentation document is one that has been formatted and is intended for presentation, usually on a printer or display device. A data stream containing a presentation document should produce the same document content in the same format on different printers or display devices dependent, however, on the capabilities of each of the printers or display devices. A presentation document can reference resources that are to be included as part of the document to be presented.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.fop.afp.modca.AbstractAFPObject

      `AbstractAFPObject.Category, AbstractAFPObject.Type`

  - ### Field Summary

    - ### Fields inherited from class org.apache.fop.afp.modca.AbstractResourceEnvironmentGroupContainer

      `resourceEnvironmentGroup`

    - ### Fields inherited from class org.apache.fop.afp.modca.AbstractResourceGroupContainer

      `resourceGroup, started`

    - ### Fields inherited from class org.apache.fop.afp.modca.AbstractPageObject

      `activeEnvironmentGroup, complete, factory, invokeMediumMaps, objects, rotation`

    - ### Fields inherited from class org.apache.fop.afp.modca.AbstractNamedAFPObject

      `name`

    - ### Fields inherited from class org.apache.fop.afp.modca.AbstractTripletStructuredObject

      `triplets`

    - ### Fields inherited from class org.apache.fop.afp.modca.AbstractAFPObject

      `LOG, SF_CLASS, SF_HEADER_LENGTH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Document(Factory factory, String name)` Constructor for the document object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `endDocument()` Method to mark the end of the page group.
    `boolean` | `isComplete()` Returns true if this object is complete
    `String` | `toString()`
    `protected void` | `writeEnd(OutputStream os)` Helper method to write the end of the Object.
    `protected void` | `writeStart(OutputStream os)` Helper method to write the start of the Object.

    - ### Methods inherited from class org.apache.fop.afp.modca.AbstractResourceEnvironmentGroupContainer

      `addPage, addPageGroup, createInvokeMediumMap, getResourceEnvironmentGroup, writeContent`

    - ### Methods inherited from class org.apache.fop.afp.modca.AbstractResourceGroupContainer

      `canWrite, getResourceCount, getResourceGroup, hasResources, writeObjects, writeObjects, writeToStream`

    - ### Methods inherited from class org.apache.fop.afp.modca.AbstractPageObject

      `addObject, createFont, createIncludePageSegment, createLine, createNoOperation, createTagLogicalElement, createText, endPage, endPresentationObject, getActiveEnvironmentGroup, getHeight, getPresentationTextObject, getRotation, getTagLogicalElements, getWidth, setComplete`

    - ### Methods inherited from class org.apache.fop.afp.modca.AbstractNamedAFPObject

      `copySF, getName, getNameBytes, getNameLength, setName`

    - ### Methods inherited from class org.apache.fop.afp.modca.AbstractTripletStructuredObject

      `addTriplet, addTriplets, getFullyQualifiedName, getTripletDataLength, getTriplets, hasTriplet, hasTriplets, setComment, setFullyQualifiedName, setFullyQualifiedName, setObjectClassification, writeTriplets`

    - ### Methods inherited from class org.apache.fop.afp.modca.AbstractAFPObject

      `copySF, truncate, writeChunksToStream`

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

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

- - ### Constructor Detail

    - #### Document

          public Document(Factory factory,
                          String name)

      Constructor for the document object.
      Parameters:
        `factory` - the object factory
        `name` - the name of the document

  - ### Method Detail

    - #### endDocument

          public void endDocument()

      Method to mark the end of the page group.

    - #### isComplete

          public boolean isComplete()

      Returns true if this object is complete
      Specified by:
        `isComplete` in interface `Completable`
      Overrides:
        `isComplete` in class `AbstractPageObject`
      Returns:
        true if this object is complete

    - #### writeStart

          protected void writeStart(OutputStream os)
                             throws IOException

      Helper method to write the start of the Object.
      Overrides:
        `writeStart` in class `AbstractStructuredObject`
      Parameters:
        `os` - The stream to write to
      Throws:
        `IOException` - throws an I/O exception if one occurred

    - #### writeEnd

          protected void writeEnd(OutputStream os)
                           throws IOException

      Helper method to write the end of the Object.
      Overrides:
        `writeEnd` in class `AbstractStructuredObject`
      Parameters:
        `os` - The stream to write to
      Throws:
        `IOException` - an I/O exception if one occurred

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `AbstractNamedAFPObject`

Copyright © 2025 Apache Software Foundation. All rights reserved.