org.apache.fop.pdf

## Class PDFResourceContext

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

- All Implemented Interfaces:
    PDFWritable
  Direct Known Subclasses:
    PDFPage

      public class PDFResourceContext
      extends PDFDictionary

  The PDF resource context. 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. Modified by Mark Lillywhite, mark-fop@inomial.com. The Parent object was being referred to by reference, but all that we ever used from the Parent was its PDF object ID, and according to the memory profile this was causing OOM issues. So, we store only the object ID of the parent, rather than the parent itself.

- - ### Field Summary

    - ### 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
    `PDFResourceContext(PDFResources resources)` Creates a new ResourceContext.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAnnotation(PDFObject annot)` set this page's annotation list
    `void` | `addGState(PDFGState gstate)` A a GState to this resource context.
    `void` | `addPattern(PDFPattern pattern)`
    `void` | `addShading(PDFShading shading)` Add the shading to the current resource context.
    `void` | `addXObject(PDFXObject xObject)`
    `PDFAnnotList` | `getAnnotations()` Get the current annotations.
    `java.util.Set<PDFGState>` | `getGStates()`
    `java.util.Set<PDFPattern>` | `getPatterns()`
    `PDFResources` | `getPDFResources()` Get the resources for this resource context.
    `java.util.Set<PDFShading>` | `getShadings()`
    `java.util.Set<PDFXObject>` | `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, toPDF, toPDFString`

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

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

- - ### Constructor Detail

    - #### PDFResourceContext

          public PDFResourceContext(PDFResources resources)

      Creates a new ResourceContext.
      Parameters:
        `resources` - the /Resources object

  - ### Method Detail

    - #### addXObject

          public void addXObject(PDFXObject xObject)

    - #### getXObjects

          public java.util.Set<PDFXObject> getXObjects()

    - #### getPDFResources

          public PDFResources getPDFResources()

      Get the resources for this resource context.
      Returns:
        the resources in this resource context

    - #### addAnnotation

          public void addAnnotation(PDFObject annot)

      set this page's annotation list
      Parameters:
        `annot` - a PDFAnnotList list of annotations

    - #### getAnnotations

          public PDFAnnotList getAnnotations()

      Get the current annotations.
      Returns:
        the current annotation list

    - #### addGState

          public void addGState(PDFGState gstate)

      A a GState to this resource context.
      Parameters:
        `gstate` - the GState to add

    - #### getGStates

          public java.util.Set<PDFGState> getGStates()

    - #### addShading

          public void addShading(PDFShading shading)

      Add the shading to the current resource context.
      Parameters:
        `shading` - the shading to add

    - #### getShadings

          public java.util.Set<PDFShading> getShadings()

    - #### getPatterns

          public java.util.Set<PDFPattern> getPatterns()

    - #### addPattern

          public void addPattern(PDFPattern pattern)

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