PDFPage (Apache FOP Core 2.11 API)
Date: 2025-04-24

org.apache.fop.pdf

## Class PDFPage

- java.lang.Object
- - org.apache.fop.pdf.PDFObject
  - - org.apache.fop.pdf.PDFDictionary
    - - org.apache.fop.pdf.PDFResourceContext
      - - org.apache.fop.pdf.PDFPage

- All Implemented Interfaces:
    PDFWritable

      public class PDFPage
      extends PDFResourceContext

  Class representing a /Page object.

  There is one of these for every page in a PDF document. The object specifies the dimensions of the page and references a /Resources object, a contents stream and the page's parent in the page hierarchy.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `pageIndex` the page index (zero-based)

    - ### 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
    `PDFPage(PDFResources resources, int pageIndex, Rectangle2D mediaBox, Rectangle2D cropBox, Rectangle2D bleedBox, Rectangle2D trimBox)` Create a /Page object

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getPageIndex()`
    `Integer` | `getStructParents()` Returns the value of the StructParents entry.
    `void` | `setBleedBox(Rectangle2D box)` Sets the "BleedBox" entry
    `void` | `setContents(PDFReference contents)` set this page contents
    `void` | `setCropBox(Rectangle2D box)` Sets the "CropBox" entry
    `void` | `setMediaBox(Rectangle2D box)` Sets the "MediaBox" entry
    `void` | `setMetadata(PDFMetadata meta)`
    `void` | `setParent(PDFPages parent)` set this page's parent
    `void` | `setStructParents(int structParents)` Sets the "StructParents" value.
    `void` | `setTabs(PDFName value)` Specifies the tab order for annotations on a page.
    `void` | `setTransition(int dur, TransitionDictionary tr)` Set the transition dictionary and duration.
    `void` | `setTrimBox(Rectangle2D box)` Sets the "TrimBox" entry

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

      `addAnnotation, addGState, addPattern, addShading, addXObject, getAnnotations, getGStates, getPatterns, getPDFResources, getShadings, getXObjects`

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

      `containsKey, get, getChildren, getChildren, keySet, output, put, put, remove, writeDictionary`

    - ### 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, setParent, supportsObjectStream, toPDF, toPDFString`

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

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

- - ### Field Detail

    - #### pageIndex

          protected int pageIndex

      the page index (zero-based)

  - ### Constructor Detail

    - #### PDFPage

          public PDFPage(PDFResources resources,
                         int pageIndex,
                         Rectangle2D mediaBox,
                         Rectangle2D cropBox,
                         Rectangle2D bleedBox,
                         Rectangle2D trimBox)

      Create a /Page object
      Parameters:
        `resources` - the /Resources object
        `pageIndex` - the page's zero-based index (or -1 if the page number is auto-determined)
        `mediaBox` - the MediaBox
        `cropBox` - the CropBox. If null, mediaBox is used.
        `bleedBox` - the BleedBox. If null, cropBox is used.
        `trimBox` - the TrimBox. If null, bleedBox is used.

  - ### Method Detail

    - #### setMediaBox

          public void setMediaBox(Rectangle2D box)

      Sets the "MediaBox" entry
      Parameters:
        `box` - the media rectangle

    - #### setCropBox

          public void setCropBox(Rectangle2D box)

      Sets the "CropBox" entry
      Parameters:
        `box` - the bleed rectangle

    - #### setBleedBox

          public void setBleedBox(Rectangle2D box)

      Sets the "BleedBox" entry
      Parameters:
        `box` - the bleed rectangle

    - #### setTrimBox

          public void setTrimBox(Rectangle2D box)

      Sets the "TrimBox" entry
      Parameters:
        `box` - the trim rectangle

    - #### setContents

          public void setContents(PDFReference contents)

      set this page contents
      Parameters:
        `contents` - the contents of the page

    - #### setParent

          public void setParent(PDFPages parent)

      set this page's parent
      Parameters:
        `parent` - the /Pages object that is this page's parent

    - #### setTransition

          public void setTransition(int dur,
                                    TransitionDictionary tr)

      Set the transition dictionary and duration. This sets the duration of the page and the transition dictionary used when going to the next page.
      Parameters:
        `dur` - the duration in seconds
        `tr` - the transition dictionary

    - #### getPageIndex

          public int getPageIndex()

      Returns:
        the page Index of this page (zero-based), -1 if it the page index should automatically be determined.

    - #### setStructParents

          public void setStructParents(int structParents)

      Sets the "StructParents" value.
      Parameters:
        `structParents` - the integer key of this object's entry in the structural parent tree.

    - #### getStructParents

          public Integer getStructParents()

      Returns the value of the StructParents entry.
      Returns:
        the StructParents value, `null` if the entry has not been set

    - #### setTabs

          public void setTabs(PDFName value)

      Specifies the tab order for annotations on a page.
      Parameters:
        `value` - one of the allowed values (see PDF 1.5)
      Since:
        PDF 1.5

    - #### setMetadata

          public void setMetadata(PDFMetadata meta)

Copyright © 2025 Apache Software Foundation. All rights reserved.