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
 
Fields inherited from class org.icepdf.core.pobjects.Dictionary
entries, isDeleted, isNew, library, SUBTYPE_KEY, TYPE_KEY
 
Constructor Summary
Form(Library l, java.util.Hashtable h, SeekableInputConstrainedWrapper streamInputWrapper)
          Creates a new instance of the xObject.
 
Method Summary
 void completed()
          When a ContentParser refers to a Form, it calls this to signal that it is done with the Form itself, while the generated Shapes are still in use.
 void dispose(boolean cache)
          When a Page refers to a Form, it calls this to cleanup and get rid of, or reduce the memory footprint of, the refered objects
 void disposeResources(boolean cache)
          Disposes the resources associated with this Form object but leaves the shapes associated with a content stream.
 java.awt.geom.Rectangle2D getBBox()
          Gets the bounding box for the xObject.
 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.
 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 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.
 
Methods inherited from class org.icepdf.core.pobjects.Stream
getBlackIs1, getBlackIs1OrNull, getBytes, getImage, getInputStreamForDecodedStreamBytes, getPObjectReference, getStreamInput, isImageMask, isInlineImage, setInlineImage, setPObjectReference, toString
 
Methods inherited from class org.icepdf.core.pobjects.Dictionary
getEntries, getFloat, getInt, getLibrary, getNumber, getObject, getObject, isDeleted, isNew, setDeleted, setNew
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Form

public Form(Library l,
            java.util.Hashtable 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

dispose

public void dispose(boolean cache)
When a Page refers to a Form, it calls this to cleanup and get rid of, or reduce the memory footprint of, the refered objects

Overrides:
dispose in class Stream

disposeResources

public void disposeResources(boolean cache)
Disposes the resources associated with this Form object but leaves the shapes associated with a content stream. This method should only be called when the Xobject will be orphaned and dispose cannot be called via normal object chaining. XObject can be orphaned when called from a content stream of an Xobject.

Parameters:
cache - true indicates the cache should be used.

completed

public void completed()
When a ContentParser refers to a Form, it calls this to signal that it is done with the Form itself, while the generated Shapes are still in use.


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

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

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.