com.qoppa.pdf.annotations
Interface IAnnotationFactory


public interface IAnnotationFactory

This interface provides methods to create annotations in a document. The methods will create annotation objects that can then be added to pages in the PDF document. To get a reference to this interface, call IPDFDocument.getAnnotationFactor().

Author:
Qoppa Software

Method Summary
 Callout createCallout(String contents)
          Constructs a callout annotation with the give content.
 Circle createCircle(String contents)
          Constructs a circle annotation with the given content.
 FileAttachment createFileAttachment()
          Creates an empty file attachment object.
 FileAttachment createFileAttachment(byte[] fileContents, String fileName, String popupText)
          Constructs a file attachment annotation.
 FileAttachment createFileAttachment(File attachFile, String popupText)
          Convenience constructor to create a file attachment from a file system file.
 FileAttachment createFileAttachment(InputStream inStream, String fileName, String popupText)
          Creates a file attachment from an input stream.
 FreeText createFreeText(String contents)
          Constructs a free text annotation with the give content.
 Ink createInk(String contents, Vector polyLines)
          Constructs an Ink annotation.
 Line createLine(String contents, double x1, double y1, double x2, double y2)
          Constructs a line annotation with the given content.
 Line createLine(String contents, double x1, double y1, double x2, double y2, String intent)
          Constructs a line annotation with the given content and intent.
 Link createLink()
          Constructs a Link annotation.
 TextMarkup createMarkupText(String contents, Vector quadList, String subtype)
          Deprecated. This method has been renamed to createTextMarkup()
 Polygon createPolygon(String contents, Vector vertices, String intent)
          Constructs a polygon annotation.
 Polyline createPolyline(String contents, Vector vertices, String intent)
          Constructs a polyline annotation.
 Popup createPopup(boolean initalOpen)
          Constructs a popup annotation with the given open flag.
 Redaction createRedaction(String contents)
          Constructs a Redaction annotation with the given content.
 Redaction createRedaction(String contents, Vector quadList)
          Constructs a new Redaction annotation defined by the quadList rather than it's rectangular bounds, unless the quadList is empty.
 RubberStamp createRubberStamp(Image image)
          Constructs a rubber stamp annotation with the given image.
 RubberStamp createRubberStamp(String text, Color color)
          Construct a rubber stamp annotation with custom text and custom color.
 RubberStamp createRubberStamp(String text, Color color, double scale)
          Construct a text rubber stamp annotation.
 Sound createSound(AudioFormat format, byte[] content)
          Constructs a sound annotation from an AudioFormat object and an array of bytes containing the audio content.
 Sound createSound(AudioInputStream audioStream)
          Constructs a sound annotation from an AudioInputStream object.
 Square createSquare(String contents)
          Constructs a square annotation with the given content.
 Text createText(String contents, boolean initialOpen, String iconName)
          Construct a Text annotation.
 TextMarkup createTextMarkup(String contents, Vector quadList, String subtype)
          Constructs a new TextMarkup annotation.
 

Method Detail

createFreeText

FreeText createFreeText(String contents)
Constructs a free text annotation with the give content. Use setBounds() to set the position and size of the text box on the page.

Parameters:
contents - The text content.

createCircle

Circle createCircle(String contents)
Constructs a circle annotation with the given content. Call Circle.setBounds() to set the bounds of the circle, the circle will be drawn so that it fits entirely within the bounds..

Parameters:
contents - The text contents to display when the annotation is opened.

createCallout

Callout createCallout(String contents)
Constructs a callout annotation with the give content. Use setBounds() to set the position and size of the text box on the page.

Parameters:
contents - The text content.

createFileAttachment

FileAttachment createFileAttachment(byte[] fileContents,
                                    String fileName,
                                    String popupText)
                                    throws IOException
Constructs a file attachment annotation. The entire contents of the file are passed in the fileContents array.

Parameters:
fileContents - The binary contents of the file.
fileName - The name of the file.
popupText - The popup text to display when the mouse hovers over the annotation.
Throws:
IOException

createFileAttachment

FileAttachment createFileAttachment(File attachFile,
                                    String popupText)
                                    throws IOException
Convenience constructor to create a file attachment from a file system file.

Parameters:
attachFile - The file to attach. The constructor reads the contents of the file into memory.
popupText - The popup text to display when the mouse hovers over the annotation.
Throws:
IOException

createFileAttachment

FileAttachment createFileAttachment(InputStream inStream,
                                    String fileName,
                                    String popupText)
                                    throws IOException
Creates a file attachment from an input stream. The method will read the contents of the input stream at the time that it is called.

Parameters:
inStream - The input stream to get the file attachment contents from.
fileName - The name of the file.
popupText - The popup text to display when the mouse hovers over the annotation.
Returns:
A FileAttachment object
Throws:
IOException - Thrown when there is any errors reading the input stream.

createFileAttachment

FileAttachment createFileAttachment()
Creates an empty file attachment object.

Returns:
A new, empty, file attachment object.

createInk

Ink createInk(String contents,
              Vector polyLines)
Constructs an Ink annotation.

Parameters:
contents - The text contents to display when the annotation is opened.
polyLines - a Vector of polylines. Each element in the Vector is another Vector containing a list of points to compose a polyline.

createLine

Line createLine(String contents,
                double x1,
                double y1,
                double x2,
                double y2)
Constructs a line annotation with the given content.

Parameters:
contents - The text contents to display when the annotation is opened.
x1 - The x coordinate of the origin of the line.
y1 - The y coordinate of the origin of the line.
x2 - The x coordinate of the end point of the line.
y2 - The y coordinate of the end point of the line.

createLine

Line createLine(String contents,
                double x1,
                double y1,
                double x2,
                double y2,
                String intent)
Constructs a line annotation with the given content and intent.

Parameters:
contents - The text contents to display when the annotation is opened.
x1 - The x coordinate of the origin of the line.
y1 - The y coordinate of the origin of the line.
x2 - The x coordinate of the end point of the line.
y2 - The y coordinate of the end point of the line.
intent - The line's "intent", this can be one of the following values: null, Line.LINE_ARROW, Line.LINE_DIMENSION.

createLink

Link createLink()
Constructs a Link annotation.


createMarkupText

TextMarkup createMarkupText(String contents,
                            Vector quadList,
                            String subtype)
Deprecated. This method has been renamed to createTextMarkup()

Constructs a new TextMarkup annotation. There are 4 types of markup annotations: text highlight, text underline, text cross-out or strike-out and text squiggly underline.

Parameters:
contents - The text contents to display when the annotation is opened.
quadList - The new list of quadrilaterals that compose this annotation. Each item in the list should be an array of 4 Point.Double objects.
subtype - type of the markup annotations. Possible values are Highlight, Underline, StrikeOut, Squiggly.

createTextMarkup

TextMarkup createTextMarkup(String contents,
                            Vector quadList,
                            String subtype)
Constructs a new TextMarkup annotation. There are 4 types of markup annotations: text highlight, text underline, text cross-out or strike-out and text squiggly underline.

Parameters:
contents - The text contents to display when the annotation is opened.
quadList - The new list of quadrilaterals that compose this annotation. Each item in the list should be an array of 4 Point.Double objects.
subtype - type of the markup annotations. Possible values are Highlight, Underline, StrikeOut, Squiggly.

createPolygon

Polygon createPolygon(String contents,
                      Vector vertices,
                      String intent)
Constructs a polygon annotation.

Parameters:
contents - The text contents to display when the annotation is opened.
vertices - A Vector of points. Each element in the Vector is a point to compose a polygon.

createPolyline

Polyline createPolyline(String contents,
                        Vector vertices,
                        String intent)
Constructs a polyline annotation.

Parameters:
contents - The text contents to display when the annotation is opened.
vertices - A Vector of points. Each element in the Vector is a point to compose a polyline.

createPopup

Popup createPopup(boolean initalOpen)
Constructs a popup annotation with the given open flag.

Parameters:
initalOpen - Flag indicating whether this annotation should be displayed open initially.

createRubberStamp

RubberStamp createRubberStamp(Image image)
Constructs a rubber stamp annotation with the given image.

Parameters:
image - a java image

createRubberStamp

RubberStamp createRubberStamp(String text,
                              Color color)
Construct a rubber stamp annotation with custom text and custom color.

Parameters:
text - the text to display in the stamp
color - the color of the text

createRubberStamp

RubberStamp createRubberStamp(String text,
                              Color color,
                              double scale)
Construct a text rubber stamp annotation. The scale of the stamp can be set with this method using the third argument.

Parameters:
text - the text to display in the stamp
color - the color of the text
scale - percentage scale for the stamp, 100 = 1:1.

createSound

Sound createSound(AudioFormat format,
                  byte[] content)
Constructs a sound annotation from an AudioFormat object and an array of bytes containing the audio content.

Parameters:
format - The format of the audio.
content - The audio content.

createSound

Sound createSound(AudioInputStream audioStream)
                  throws IOException
Constructs a sound annotation from an AudioInputStream object.

Parameters:
audioStream - The audio stream
Returns:
The new sound annotation
Throws:
IOException

createSquare

Square createSquare(String contents)
Constructs a square annotation with the given content. Call Square.setBounds() to set the bounds of the square.

Parameters:
contents - The text contents to display when the annotation is opened.

createText

Text createText(String contents,
                boolean initialOpen,
                String iconName)
Construct a Text annotation.

Parameters:
contents - The textual content.
initialOpen - Flag indicating whether this annotation should be displayed open initially.
iconName - The name of the icon to use when displaying the annotation in its un-opened mode. Please use one of the constants defined in this class (ICON_XXXX) to set the name of the icon.

createRedaction

Redaction createRedaction(String contents)
Constructs a Redaction annotation with the given content. Call Redaction.setBounds() to set the bounds of the redaction.

Parameters:
contents - The text contents to display when the annotation is opened.

createRedaction

Redaction createRedaction(String contents,
                          Vector quadList)
Constructs a new Redaction annotation defined by the quadList rather than it's rectangular bounds, unless the quadList is empty.

Parameters:
contents - The text contents to display when the annotation is opened.
quadList - The new list of quadrilaterals that compose this annotation. Each item in the list should be an array of 4 Point.Double objects.