Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.graphics.form

public Class PDFormXObject

extends PDXObject
implements PDContentStream
Class Inheritance
All Implemented Interfaces
org.apache.pdfbox.contentstream.PDContentStream
Known Direct Subclasses
org.apache.pdfbox.pdmodel.graphics.form.PDTransparencyGroup, org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream
Imports
java.awt.geom.AffineTransform, java.io.IOException, .InputStream, org.apache.pdfbox.contentstream.PDContentStream, org.apache.pdfbox.cos.COSArray, .COSDictionary, .COSFloat, .COSName, .COSStream, org.apache.pdfbox.io.RandomAccessInputStream, .RandomAccessRead, org.apache.pdfbox.pdmodel.PDDocument, .PDResources, .ResourceCache, org.apache.pdfbox.pdmodel.common.PDRectangle, .PDStream, org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDPropertyList, org.apache.pdfbox.pdmodel.graphics.PDXObject, org.apache.pdfbox.util.Matrix

A Form XObject.
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private final ResourceCache
private PDTransparencyGroupAttributes

Constructor Summary

AccessConstructor and Description
public
PDFormXObject(PDStream
The XObject stream
stream
)

Creates a Form XObject for reading.

public
PDFormXObject(COSStream
The XObject stream
stream
)

Creates a Form XObject for reading.

public
PDFormXObject(COSStream
The XObject stream
stream
,
ResourceCache
the cache to be used for the resources
cache
)

Creates a Form XObject for reading.

public
PDFormXObject(PDDocument
The current document
document
)

Creates a Form Image XObject for writing, in the given document.

Method Summary

Modifier and TypeMethod and Description
public PDRectangle

Returns:

The BBox of the form.
getBBox
()

Implements org.apache.pdfbox.contentstream.PDContentStream.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.

public InputStream
getContents()

Implements org.apache.pdfbox.contentstream.PDContentStream.getContents.

Returns this stream's content, if any.

public RandomAccessRead
public PDStream
public int

Returns:

The form type.
getFormType
()

This will get the form type, currently 1 is the only form type.

public PDTransparencyGroupAttributes

Returns:

the group attributes dictionary
getGroup
()

Returns the group attributes dictionary.

public Matrix

Returns:

the form matrix if available, or the identity matrix.
getMatrix
()

Implements org.apache.pdfbox.contentstream.PDContentStream.getMatrix.

This will get the optional matrix of an XObjectForm.

public PDPropertyList

Returns:

The optional content group or optional content membership dictionary or null if there is none.
getOptionalContent
()

This will get the optional content group or optional content membership dictionary.

public PDResources

Returns:

The resources for this Form XObject.
getResources
()

Implements org.apache.pdfbox.contentstream.PDContentStream.getResources.

This will get the resources for this Form XObject.

public int

Returns:

the integer key of the XObjectForm's entry in the structural parent tree or -1 if there isn't any.
getStructParents
()

This will get the key of this XObjectForm in the structural parent tree.

public void
setBBox(PDRectangle
The new BBox for this form.
bbox
)

This will set the BBox (bounding box) for this form.

public void
setFormType(int
The new form type.
formType
)

Set the form type.

public void
setMatrix(AffineTransform
the transformation matrix
transform
)

Sets the optional Matrix entry for the form XObject.

public void
setOptionalContent(PDPropertyList
The optional content group or optional content membership dictionary.
oc
)

Sets the optional content group or optional content membership dictionary.

public void
setResources(PDResources
The new resources for this page.
resources
)

This will set the resources for this page.

public void
setStructParents(int
The new key for this XObjectForm.
structParent
)

This will set the key for this XObjectForm in the structural parent tree.

Inherited from org.apache.pdfbox.pdmodel.graphics.PDXObject:
createXObjectgetCOSObjectgetStream

Field Detail

cacheback to summary
private final ResourceCache cache
groupback to summary
private PDTransparencyGroupAttributes group

Constructor Detail

PDFormXObjectback to summary
public PDFormXObject(PDStream stream)

Creates a Form XObject for reading.

Parameters
stream:PDStream

The XObject stream

PDFormXObjectback to summary
public PDFormXObject(COSStream stream)

Creates a Form XObject for reading.

Parameters
stream:COSStream

The XObject stream

PDFormXObjectback to summary
public PDFormXObject(COSStream stream, ResourceCache cache)

Creates a Form XObject for reading.

Parameters
stream:COSStream

The XObject stream

cache:ResourceCache

the cache to be used for the resources

PDFormXObjectback to summary
public PDFormXObject(PDDocument document)

Creates a Form Image XObject for writing, in the given document.

Parameters
document:PDDocument

The current document

Method Detail

getBBoxback to summary
public PDRectangle getBBox()

Implements org.apache.pdfbox.contentstream.PDContentStream.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.

Returns:PDRectangle

The BBox of the form.

Annotations
@Override
getContentsback to summary
public InputStream getContents() throws IOException

Implements org.apache.pdfbox.contentstream.PDContentStream.getContents.

Doc from org.apache.pdfbox.contentstream.PDContentStream.getContents.

Returns this stream's content, if any.

Returns:InputStream

An InputStream or null.

Annotations
@Override
Exceptions
IOException:
If the stream could not be read
getContentsForRandomAccessback to summary
public RandomAccessRead getContentsForRandomAccess() throws IOException

Implements org.apache.pdfbox.contentstream.PDContentStream.getContentsForRandomAccess.

Doc from org.apache.pdfbox.contentstream.PDContentStream.getContentsForRandomAccess.

Returns this stream's content, if any.

Returns:RandomAccessRead

A RandomAccessRead or null.

Annotations
@Override
Exceptions
IOException:
If the content could not be read
getContentStreamback to summary
public PDStream getContentStream()
getFormTypeback to summary
public int getFormType()

This will get the form type, currently 1 is the only form type.

Returns:int

The form type.

getGroupback to summary
public PDTransparencyGroupAttributes getGroup()

Returns the group attributes dictionary.

Returns:PDTransparencyGroupAttributes

the group attributes dictionary

getMatrixback to summary
public Matrix getMatrix()

Implements org.apache.pdfbox.contentstream.PDContentStream.getMatrix.

This will get the optional matrix of an XObjectForm. It maps the form space to user space.

Returns:Matrix

the form matrix if available, or the identity matrix.

Annotations
@Override
getOptionalContentback to summary
public PDPropertyList getOptionalContent()

This will get the optional content group or optional content membership dictionary.

Returns:PDPropertyList

The optional content group or optional content membership dictionary or null if there is none.

getResourcesback to summary
public PDResources getResources()

Implements org.apache.pdfbox.contentstream.PDContentStream.getResources.

This will get the resources for this Form XObject. This will return null if no resources are available.

Returns:PDResources

The resources for this Form XObject.

Annotations
@Override
getStructParentsback to summary
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:int

the integer key of the XObjectForm's entry in the structural parent tree or -1 if there isn't any.

setBBoxback to summary
public void setBBox(PDRectangle bbox)

This will set the BBox (bounding box) for this form.

Parameters
bbox:PDRectangle

The new BBox for this form.

setFormTypeback to summary
public void setFormType(int formType)

Set the form type.

Parameters
formType:int

The new form type.

setMatrixback to summary
public void setMatrix(AffineTransform transform)

Sets the optional Matrix entry for the form XObject.

Parameters
transform:AffineTransform

the transformation matrix

setOptionalContentback to summary
public void setOptionalContent(PDPropertyList oc)

Sets the optional content group or optional content membership dictionary.

Parameters
oc:PDPropertyList

The optional content group or optional content membership dictionary.

setResourcesback to summary
public void setResources(PDResources resources)

This will set the resources for this page.

Parameters
resources:PDResources

The new resources for this page.

setStructParentsback to summary
public void setStructParents(int structParent)

This will set the key for this XObjectForm in the structural parent tree.

Parameters
structParent:int

The new key for this XObjectForm.