org.pdfbox.pdmodel.graphics.xobject
Class PDXObject

java.lang.Object
  extended byorg.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.

Version:
$Revision: 1.13 $
Author:
Ben Litchfield, mathiak, Marcel Kammer

Constructor Summary
PDXObject(COSStream xobj)
          Standard constuctor.
PDXObject(PDDocument doc)
          Standard constuctor.
PDXObject(PDStream xobj)
          Standard constuctor.
 
Method Summary
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.
 void setMetadata(PDMetadata meta)
          Set the metadata for this object.
 
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 constuctor.

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.

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.