Class PDXObject

java.lang.Object
org.sejda.sambox.pdmodel.graphics.PDXObject
All Implemented Interfaces:
COSObjectable
Direct Known Subclasses:
PDFormXObject, PDImageXObject, PDPostScriptXObject

public class PDXObject extends Object implements COSObjectable
An external object, or "XObject".
Author:
Ben Litchfield, John Hewson
  • Constructor Details

    • PDXObject

      protected PDXObject(COSStream stream, COSName subtype)
      Creates a new XObject from the given stream and subtype.
      Parameters:
      stream - The stream to read.
      subtype -
    • PDXObject

      protected PDXObject(PDStream stream, COSName subtype)
      Creates a new XObject from the given stream and subtype.
      Parameters:
      stream - The stream to read.
      subtype -
    • PDXObject

      protected PDXObject(COSName subtype)
      Creates a new XObject from the given stream and subtype.
      Parameters:
      stream - The stream to read.
  • Method Details

    • createXObject

      public static PDXObject createXObject(COSBase base, PDResources resources) throws IOException
      Creates a new XObject instance of the appropriate type for the COS stream.
      Parameters:
      base - The stream which is wrapped by this XObject.
      Returns:
      A new XObject instance.
      Throws:
      IOException - if there is an error creating the XObject.
    • getCOSObject

      public final COSStream getCOSObject()
      Returns the stream.
      Specified by:
      getCOSObject in interface COSObjectable
      Returns:
      The COSBase that matches this Java object.
    • getStream

      public final PDStream getStream()
      Returns the stream.
      Returns:
      The stream for this object.
    • setStream

      public final void setStream(PDStream stream)