org.apache.fop.afp.modca

## Class PageObject

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

- All Implemented Interfaces:
    Completable, Streamable
  Direct Known Subclasses:
    Overlay

      public class PageObject
      extends AbstractResourceGroupContainer

  Pages contain the data objects that comprise a presentation document. Each page has a set of data objects associated with it. Each page within a document is independent from any other page, and each must establish its own environment parameters. The page is the level in the document component hierarchy that is used for printing or displaying a document's content. The data objects contained in the page envelope in the data stream are presented when the page is presented. Each data object has layout information associated with it that directs the placement and orientation of the data on the page. In addition, each page contains layout information that specifies the measurement units, page width, and page depth. A page is initiated by a begin page structured field and terminated by an end page structured field. Structured fields that define objects and active environment groups or that specify attributes of the page may be encountered in page state.

- - ### 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.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
    `PageObject(Factory factory, String name, int width, int height, int rotation, int widthRes, int heightRes)` Construct a new page object for the specified name argument, the page name should be an 8 character identifier.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addObject(Object obj)` Adds an AFP object reference to this page
    `protected boolean` | `canWrite(AbstractAFPObject ao)` Returns true if this object can be written
    `void` | `createIncludePageOverlay(String name, int x, int y, int orientation)` Creates an IncludePageOverlay on the page.
    `void` | `createShading(int x, int y, int w, int h, int red, int green, int blue)` This method will create shading on the page using the specified coordinates (the shading contrast is controlled via the red, green blue parameters, by converting this to grayscale).
    `String` | `toString()`
    `protected void` | `writeContent(OutputStream os)` Helper method to write the contents of the Object.
    `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.AbstractResourceGroupContainer

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

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

      `createFont, createIncludePageSegment, createInvokeMediumMap, createLine, createNoOperation, createTagLogicalElement, createText, endPage, endPresentationObject, getActiveEnvironmentGroup, getHeight, getPresentationTextObject, getRotation, getTagLogicalElements, getWidth, isComplete, 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

    - #### PageObject

          public PageObject(Factory factory,
                            String name,
                            int width,
                            int height,
                            int rotation,
                            int widthRes,
                            int heightRes)

      Construct a new page object for the specified name argument, the page name should be an 8 character identifier.
      Parameters:
        `factory` - the resource manager
        `name` - the name of the page.
        `width` - the width of the page.
        `height` - the height of the page.
        `rotation` - the rotation of the page.
        `widthRes` - the width resolution of the page.
        `heightRes` - the height resolution of the page.

  - ### Method Detail

    - #### createIncludePageOverlay

          public void createIncludePageOverlay(String name,
                                               int x,
                                               int y,
                                               int orientation)

      Creates an IncludePageOverlay on the page.
      Parameters:
        `name` - the name of the overlay
        `x` - the x position of the overlay
        `y` - the y position of the overlay
        `orientation` - the orientation required for the overlay

    - #### createShading

          public void createShading(int x,
                                    int y,
                                    int w,
                                    int h,
                                    int red,
                                    int green,
                                    int blue)

      This method will create shading on the page using the specified coordinates (the shading contrast is controlled via the red, green blue parameters, by converting this to grayscale).
      Parameters:
        `x` - the x coordinate of the shading
        `y` - the y coordinate of the shading
        `w` - the width of the shaded area
        `h` - the height of the shaded area
        `red` - the red value
        `green` - the green value
        `blue` - the blue value

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

    - #### writeContent

          protected void writeContent(OutputStream os)
                               throws IOException

      Helper method to write the contents of the Object.
      Overrides:
        `writeContent` in class `AbstractPageObject`
      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

    - #### addObject

          public void addObject(Object obj)

      Adds an AFP object reference to this page
      Overrides:
        `addObject` in class `AbstractPageObject`
      Parameters:
        `obj` - an AFP object

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `AbstractNamedAFPObject`

    - #### canWrite

          protected boolean canWrite(AbstractAFPObject ao)

      Returns true if this object can be written
      Overrides:
        `canWrite` in class `AbstractResourceGroupContainer`
      Parameters:
        `ao` - an AFP object
      Returns:
        true if this object can be written

Copyright © 2023 Apache Software Foundation. All rights reserved.