org.icepdf.core.pobjects
Class Form

java.lang.Object
  extended by org.icepdf.core.pobjects.Dictionary
      extended by org.icepdf.core.pobjects.Stream
          extended by org.icepdf.core.pobjects.Form

public class Form
extends Stream

Form XObject class. Not currently part of the public api.

Forms are grouped into the 'Resource' category and can be shared. As a result we need to make sure that the init method are synchronized as they can be accessed by different page loading threads.

Since:
1.0

Field Summary
static Name BBOX_KEY
           
static Name GROUP_KEY
           
static Name I_KEY
           
static Name K_KEY
           
static Name MATRIX_KEY
           
static Name RESOURCES_KEY
           
static Name SUB_TYPE_VALUE
           
static Name TYPE_VALUE
           
 
Fields inherited from class org.icepdf.core.pobjects.Stream
COLORSPACE_KEY, compressed, CS_KEY, DECODEPARAM_KEY, F_KEY, FILTER_KEY, H_KEY, HEIGHT_KEY, IM_KEY, IMAGEMASK_KEY, INDEXED_KEY, pObjectReference, rawBytes, W_KEY, WIDTH_KEY
 
Fields inherited from class org.icepdf.core.pobjects.Dictionary
entries, FORM_TYPE_KEY, isDeleted, isNew, LENGTH_KEY, library, SUBTYPE_KEY, TYPE_KEY
 
Constructor Summary
Form(Library l, java.util.HashMap h, SeekableInputConstrainedWrapper streamInputWrapper)
          Creates a new instance of the xObject.
 
Method Summary
 java.awt.geom.Rectangle2D getBBox()
          Gets the bounding box for the xObject.
 GraphicsState getGraphicsState()
          Gets the associated graphic state instance for this form.
 java.awt.geom.AffineTransform getMatrix()
          Gets the optional matrix which describes how to convert the coordinate system in xObject space to the parent coordinates space.
 Resources getResources()
           
 Shapes getShapes()
          Gets the shapes that where parsed from the content stream.
 void init()
          Initiate the Dictionary.
 boolean isIsolated()
          Only present if a transparency group is present.
 boolean isKnockOut()
          Only present if a transparency group is present.
 boolean isTransparencyGroup()
          If the xObject has a transparency group flag.
 void setAppearance(Shapes shapes, java.awt.geom.AffineTransform matrix, java.awt.geom.Rectangle2D bbox)
           
 void setGraphicsState(GraphicsState graphicsState)
          Sets the GraphicsState which should be used by the content parser when parsing the Forms content stream.
 void setParentResources(Resources parentResource)
          As of the PDF 1.2 specification, a resource entry is not required for a XObject and thus it needs to point to the parent resource to enable to correctly load the content stream.
 void setResources(Resources resources)
           
 
Methods inherited from class org.icepdf.core.pobjects.Stream
getDecodedByteArrayInputStream, getDecodedStreamBytes, getDecodedStreamBytes, getFilterNames, getNormalisedFilterNames, getPObjectReference, getRawBytes, isImageSubtype, isRawBytesCompressed, setPObjectReference, setRawBytes, toString
 
Methods inherited from class org.icepdf.core.pobjects.Dictionary
getEntries, getFloat, getInt, getLibrary, getNumber, getObject, isDeleted, isNew, setDeleted, setNew
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_VALUE

public static final Name TYPE_VALUE

SUB_TYPE_VALUE

public static final Name SUB_TYPE_VALUE

GROUP_KEY

public static final Name GROUP_KEY

I_KEY

public static final Name I_KEY

K_KEY

public static final Name K_KEY

MATRIX_KEY

public static final Name MATRIX_KEY

BBOX_KEY

public static final Name BBOX_KEY

RESOURCES_KEY

public static final Name RESOURCES_KEY
Constructor Detail

Form

public Form(Library l,
            java.util.HashMap h,
            SeekableInputConstrainedWrapper streamInputWrapper)
Creates a new instance of the xObject.

Parameters:
l - document library
h - xObject dictionary entries.
streamInputWrapper - content stream of image or post script commands.
Method Detail

setAppearance

public void setAppearance(Shapes shapes,
                          java.awt.geom.AffineTransform matrix,
                          java.awt.geom.Rectangle2D bbox)

setGraphicsState

public void setGraphicsState(GraphicsState graphicsState)
Sets the GraphicsState which should be used by the content parser when parsing the Forms content stream. The GraphicsState should be set before init() is called, or it will have not effect on the rendered content.

Parameters:
graphicsState - current graphic state

getGraphicsState

public GraphicsState getGraphicsState()
Gets the associated graphic state instance for this form.

Returns:
external graphic state, can be null.

setParentResources

public void setParentResources(Resources parentResource)
As of the PDF 1.2 specification, a resource entry is not required for a XObject and thus it needs to point to the parent resource to enable to correctly load the content stream.

Parameters:
parentResource - parent objects resourse when available.

init

public void init()
Description copied from class: Dictionary
Initiate the Dictionary. Retrieve any needed attributes.

Overrides:
init in class Dictionary

getResources

public Resources getResources()

setResources

public void setResources(Resources resources)

getShapes

public Shapes getShapes()
Gets the shapes that where parsed from the content stream.

Returns:
shapes object for xObject.

getBBox

public java.awt.geom.Rectangle2D getBBox()
Gets the bounding box for the xObject.

Returns:
rectangle in PDF coordinate space representing xObject bounds.

getMatrix

public java.awt.geom.AffineTransform getMatrix()
Gets the optional matrix which describes how to convert the coordinate system in xObject space to the parent coordinates space.

Returns:
affine transform representing the xObject's pdf to xObject space transform.

isTransparencyGroup

public boolean isTransparencyGroup()
If the xObject has a transparency group flag.

Returns:
true if a transparency group exists, false otherwise.

isIsolated

public boolean isIsolated()
Only present if a transparency group is present. Isolated groups are composed on a fully transparent back drop rather then the groups.

Returns:
true if the transparency group is isolated.

isKnockOut

public boolean isKnockOut()
Only present if a transparency group is present. Knockout groups individual elements composed with the groups initial back drop rather then the stack.

Returns:
true if the transparency group is a knockout.