Class PDXObject
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.graphics.xobject.PDXObject
-
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
PDXObjectForm,PDXObjectImage
public abstract class PDXObject extends java.lang.Object implements COSObjectable
The base class for all XObjects in the PDF document.- Author:
- Ben Litchfield, mathiak, Marcel Kammer
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Calling this will release all cached information.protected static PDXObjectcommonXObjectCreation(COSBase xobject, boolean isThumb)Create the correct xobject from the cos base.static PDXObjectcreateXObject(COSBase xobject)Create the correct xobject from the cos base.COSBasegetCOSObject()Returns the stream.COSStreamgetCOSStream()Returns the stream.PDMetadatagetMetadata()Get the metadata that is part of the document catalog.PDStreamgetPDStream()Returns the stream.intgetStructParent()This will get the key of this XObject in the structural parent tree.voidsetMetadata(PDMetadata meta)Set the metadata for this object.voidsetStructParent(int structParent)This will set the key for this XObject in the structural parent tree.
-
-
-
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:
getCOSObjectin interfaceCOSObjectable- 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 java.io.IOException
Create the correct xobject from the cos base.- Parameters:
xobject- The cos level xobject to create.- Returns:
- a pdmodel xobject
- Throws:
java.io.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:
java.io.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.
-
-