Class PDFormXObject
- java.lang.Object
-
- com.tom_roush.pdfbox.pdmodel.graphics.PDXObject
-
- com.tom_roush.pdfbox.pdmodel.graphics.form.PDFormXObject
-
- All Implemented Interfaces:
PDContentStream,COSObjectable
- Direct Known Subclasses:
PDAppearanceStream,PDTransparencyGroup
public class PDFormXObject extends PDXObject implements PDContentStream
A Form XObject.
-
-
Constructor Summary
Constructors Constructor Description PDFormXObject(COSStream stream)Creates a Form XObject for reading.PDFormXObject(COSStream stream, ResourceCache cache)Creates a Form XObject for reading.PDFormXObject(PDStream stream)Creates a Form XObject for reading.PDFormXObject(PDDocument document)Creates a Form Image XObject for writing, in the given document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PDRectanglegetBBox()An array of four numbers in the form coordinate system (see below), giving the coordinates of the left, bottom, right, and top edges, respectively, of the form XObject's bounding box.InputStreamgetContents()Returns this stream's content, if any.PDStreamgetContentStream()intgetFormType()This will get the form type, currently 1 is the only form type.PDTransparencyGroupAttributesgetGroup()Returns the group attributes dictionary.MatrixgetMatrix()This will get the optional matrix of an XObjectForm.PDPropertyListgetOptionalContent()This will get the optional content group or optional content membership dictionary.PDResourcesgetResources()This will get the resources for this Form XObject.intgetStructParents()This will get the key of this XObjectForm in the structural parent tree.voidsetBBox(PDRectangle bbox)This will set the BBox (bounding box) for this form.voidsetFormType(int formType)Set the form type.voidsetMatrix(AffineTransform transform)Sets the optional Matrix entry for the form XObject.voidsetOptionalContent(PDPropertyList oc)Sets the optional content group or optional content membership dictionary.voidsetResources(PDResources resources)This will set the resources for this page.voidsetStructParents(int structParent)This will set the key for this XObjectForm in the structural parent tree.-
Methods inherited from class com.tom_roush.pdfbox.pdmodel.graphics.PDXObject
createXObject, getCOSObject, getCOSStream, getPDStream, getStream
-
-
-
-
Constructor Detail
-
PDFormXObject
public PDFormXObject(PDStream stream)
Creates a Form XObject for reading.- Parameters:
stream- The XObject stream
-
PDFormXObject
public PDFormXObject(COSStream stream)
Creates a Form XObject for reading.- Parameters:
stream- The XObject stream
-
PDFormXObject
public PDFormXObject(COSStream stream, ResourceCache cache)
Creates a Form XObject for reading.- Parameters:
stream- The XObject stream
-
PDFormXObject
public PDFormXObject(PDDocument document)
Creates a Form Image XObject for writing, in the given document.- Parameters:
document- The current document
-
-
Method Detail
-
getFormType
public int getFormType()
This will get the form type, currently 1 is the only form type.- Returns:
- The form type.
-
setFormType
public void setFormType(int formType)
Set the form type.- Parameters:
formType- The new form type.
-
getGroup
public PDTransparencyGroupAttributes getGroup()
Returns the group attributes dictionary.- Returns:
- the group attributes dictionary
-
getContentStream
public PDStream getContentStream()
-
getContents
public InputStream getContents() throws IOException
Description copied from interface:PDContentStreamReturns this stream's content, if any.- Specified by:
getContentsin interfacePDContentStream- Returns:
- An InputStream or null.
- Throws:
IOException- If the stream could not be read
-
getResources
public PDResources getResources()
This will get the resources for this Form XObject. This will return null if no resources are available.- Specified by:
getResourcesin interfacePDContentStream- Returns:
- The resources for this Form XObject.
-
setResources
public void setResources(PDResources resources)
This will set the resources for this page.- Parameters:
resources- The new resources for this page.
-
getBBox
public PDRectangle getBBox()
An array of four numbers in the form coordinate system (see below), giving the coordinates of the left, bottom, right, and top edges, respectively, of the form XObject's bounding box. These boundaries are used to clip the form XObject and to determine its size for caching.- Specified by:
getBBoxin interfacePDContentStream- Returns:
- The BBox of the form.
-
setBBox
public void setBBox(PDRectangle bbox)
This will set the BBox (bounding box) for this form.- Parameters:
bbox- The new BBox for this form.
-
getMatrix
public Matrix getMatrix()
This will get the optional matrix of an XObjectForm. It maps the form space to user space.- Specified by:
getMatrixin interfacePDContentStream- Returns:
- the form matrix if available, or the identity matrix.
-
setMatrix
public void setMatrix(AffineTransform transform)
Sets the optional Matrix entry for the form XObject.- Parameters:
transform- the transformation matrix
-
getStructParents
public int getStructParents()
This will get the key of this XObjectForm in the structural parent tree. Required if the form XObject contains marked-content sequences that are structural content items.- Returns:
- the integer key of the XObjectForm's entry in the structural parent tree or -1 if there isn't any.
-
setStructParents
public void setStructParents(int structParent)
This will set the key for this XObjectForm in the structural parent tree.- Parameters:
structParent- The new key for this XObjectForm.
-
getOptionalContent
public PDPropertyList getOptionalContent()
This will get the optional content group or optional content membership dictionary.- Returns:
- The optional content group or optional content membership dictionary or null if there is none.
-
setOptionalContent
public void setOptionalContent(PDPropertyList oc)
Sets the optional content group or optional content membership dictionary.- Parameters:
oc- The optional content group or optional content membership dictionary.
-
-