org.apache.pdfbox.pdmodel.graphics.xobject
Class PDXObject

java.lang.Object
  extended by org.apache.pdfbox.pdmodel.graphics.xobject.PDXObject
All Implemented Interfaces:
COSObjectable
Direct Known Subclasses:
PDXObjectForm, PDXObjectImage

public abstract class PDXObject
extends Object
implements COSObjectable

The base class for all XObjects in the PDF document.

Author:
Ben Litchfield, mathiak, Marcel Kammer

Constructor Summary
PDXObject(COSStream xobj)
          Standard constructor.
PDXObject(PDDocument doc)
          Standard constuctor.
PDXObject(PDStream xobj)
          Standard constuctor.
 
Method Summary
 void clear()
          Calling this will release all cached information.
protected static PDXObject commonXObjectCreation(COSBase xobject, boolean isThumb)
          Create the correct xobject from the cos base.
static PDXObject createXObject(COSBase xobject)
          Create the correct xobject from the cos base.
 COSBase getCOSObject()
          Returns the stream.
 COSStream getCOSStream()
          Returns the stream.
 PDMetadata getMetadata()
          Get the metadata that is part of the document catalog.
 PDStream getPDStream()
          Returns the stream.
 int getStructParent()
          This will get the key of this XObject in the structural parent tree.
 void setMetadata(PDMetadata meta)
          Set the metadata for this object.
 void setStructParent(int structParent)
          This will set the key for this XObject in the structural parent tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDXObject

public PDXObject(COSStream xobj)
Standard constructor.

Parameters:
xobj - The XObject dictionary.

PDXObject

public PDXObject(PDStream xobj)
Standard constuctor.

Parameters:
xobj - The XObject dictionary.

PDXObject

public PDXObject(PDDocument doc)
Standard constuctor.

Parameters:
doc - The doc to store the object contents.
Method Detail

getCOSObject

public COSBase getCOSObject()
Returns the stream. Convert this standard java object to a COS object.

Specified by:
getCOSObject in interface COSObjectable
Returns:
The cos object that matches this Java object.

getCOSStream

public COSStream getCOSStream()
Returns the stream.

Returns:
The stream for this object.

getPDStream

public PDStream getPDStream()
Returns the stream.

Returns:
The stream for this object.

createXObject

public static PDXObject createXObject(COSBase xobject)
                               throws IOException
Create the correct xobject from the cos base.

Parameters:
xobject - The cos level xobject to create.
Returns:
a pdmodel xobject
Throws:
IOException - If there is an error creating the xobject.

commonXObjectCreation

protected static PDXObject commonXObjectCreation(COSBase xobject,
                                                 boolean isThumb)
Create the correct xobject from the cos base.

Parameters:
xobject - The cos level xobject to create.
isThumb - specify if the xobject represent a Thumbnail Image (in this case, the subtype null must be considered as an Image)
Returns:
a pdmodel xobject
Throws:
IOException - If there is an error creating the xobject.

getMetadata

public PDMetadata getMetadata()
Get the metadata that is part of the document catalog. This will return null if there is no meta data for this object.

Returns:
The metadata for this object.

setMetadata

public void setMetadata(PDMetadata meta)
Set the metadata for this object. This can be null.

Parameters:
meta - The meta data for this object.

getStructParent

public int getStructParent()
This will get the key of this XObject in the structural parent tree. Required if the form XObject is a structural content item.

Returns:
the integer key of the XObject's entry in the structural parent tree

setStructParent

public void setStructParent(int structParent)
This will set the key for this XObject in the structural parent tree.

Parameters:
structParent - The new key for this XObject.

clear

public void clear()
Calling this will release all cached information.



Copyright © 2002-2014 The Apache Software Foundation. All Rights Reserved.