java.lang.Object
org.sejda.sambox.pdmodel.graphics.PDXObject
org.sejda.sambox.pdmodel.graphics.form.PDFormXObject
- All Implemented Interfaces:
PDContentStream,COSObjectable
- Direct Known Subclasses:
PDAppearanceStream,PDTransparencyGroup
A Form XObject.
- Author:
- Ben Litchfield
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a Form Image XObject for writing, in the given document.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. -
Method Summary
Modifier and TypeMethodDescriptiongetBBox()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.Returns this stream's content, if any.intThis will get the form type, currently 1 is the only form type.getGroup()Returns the group attributes dictionary (Group XObject).This will get the optional Matrix of an XObjectForm.Returns this stream's resources, if any.intThis 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.voidvoidsetMatrix(AffineTransform transform) Sets the optional Matrix entry for the form XObject.voidSets 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 org.sejda.sambox.pdmodel.graphics.PDXObject
createXObject, getCOSObject, getStream, setStream
-
Constructor Details
-
PDFormXObject
Creates a Form XObject for reading.- Parameters:
stream- The XObject stream
-
PDFormXObject
Creates a Form XObject for reading.- Parameters:
stream- The XObject stream
-
PDFormXObject
Creates a Form XObject for reading.- Parameters:
stream- The XObject stream
-
PDFormXObject
public PDFormXObject()Creates a Form Image XObject for writing, in the given document.- Parameters:
document- The current document
-
-
Method Details
-
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
Returns the group attributes dictionary (Group XObject).- Returns:
- the group attributes dictionary
-
setGroup
-
getContentStream
-
getContents
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
Description copied from interface:PDContentStreamReturns this stream's resources, if any.- Specified by:
getResourcesin interfacePDContentStream
-
setResources
This will set the resources for this page.- Parameters:
resources- The new resources for this page.
-
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
This will set the BBox (bounding box) for this form.- Parameters:
bbox- The new BBox for this form.
-
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
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
- Returns:
- The optional content group or optional content membership dictionary or null if there is none.
-
setOptionalContent
Sets the optional content group or optional content membership dictionary.
-