Class PDFormXObject
java.lang.Object
org.apache.pdfbox.pdmodel.graphics.PDXObject
org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject
- All Implemented Interfaces:
PDContentStream
,COSObjectable
- Direct Known Subclasses:
PDAppearanceStream
,PDTransparencyGroup
A Form XObject.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ResourceCache
private PDTransparencyGroupAttributes
-
Constructor Summary
ConstructorsConstructorDescriptionPDFormXObject
(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
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.int
This will get the form type, currently 1 is the only form type.getGroup()
Returns the group attributes dictionary.This will get the optional matrix of an XObjectForm.This will get the optional content group or optional content membership dictionary.This will get the resources for this Form XObject.int
This will get the key of this XObjectForm in the structural parent tree.void
setBBox
(PDRectangle bbox) This will set the BBox (bounding box) for this form.void
setFormType
(int formType) Set the form type.void
setMatrix
(AffineTransform transform) Sets the optional Matrix entry for the form XObject.void
Sets the optional content group or optional content membership dictionary.void
setResources
(PDResources resources) This will set the resources for this page.void
setStructParents
(int structParent) This will set the key for this XObjectForm in the structural parent tree.Methods inherited from class org.apache.pdfbox.pdmodel.graphics.PDXObject
createXObject, getCOSObject, getCOSStream, getPDStream, getStream
-
Field Details
-
group
-
cache
-
-
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
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.- Returns:
- the group attributes dictionary
-
getContentStream
-
getContents
Description copied from interface:PDContentStream
Returns this stream's content, if any.- Specified by:
getContents
in interfacePDContentStream
- Returns:
- An InputStream or null.
- Throws:
IOException
- If the stream could not be read
-
getResources
This will get the resources for this Form XObject. This will return null if no resources are available.- Specified by:
getResources
in interfacePDContentStream
- Returns:
- The resources for this Form XObject.
-
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:
getBBox
in 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:
getMatrix
in 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
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
Sets the optional content group or optional content membership dictionary.- Parameters:
oc
- The optional content group or optional content membership dictionary.
-