com.lowagie.text.pdf
Class PdfAnnotation

java.lang.Object
  |
  +--com.lowagie.text.pdf.PdfObject
        |
        +--com.lowagie.text.pdf.PdfDictionary
              |
              +--com.lowagie.text.pdf.PdfAnnotation
Direct Known Subclasses:
PdfFormField

public class PdfAnnotation
extends PdfDictionary

A PdfAnnotation is a note that is associated with a page.

See Also:
PdfDictionary

Field Summary
static PdfName AA_BLUR
           
static PdfName AA_DOWN
           
static PdfName AA_ENTER
           
static PdfName AA_EXIT
           
static PdfName AA_FOCUS
           
static PdfName AA_JS_CHANGE
           
static PdfName AA_JS_FORMAT
           
static PdfName AA_JS_KEY
           
static PdfName AA_JS_OTHER_CHANGE
           
static PdfName AA_UP
           
protected  boolean annotation
           
static PdfName APPEARANCE_DOWN
           
static PdfName APPEARANCE_NORMAL
           
static PdfName APPEARANCE_ROLLOVER
           
static int FLAGS_HIDDEN
           
static int FLAGS_INVISIBLE
           
static int FLAGS_NOROTATE
           
static int FLAGS_NOVIEW
           
static int FLAGS_NOZOOM
           
static int FLAGS_PRINT
           
static int FLAGS_READONLY
           
protected  boolean form
           
static PdfName HIGHLIGHT_INVERT
           
static PdfName HIGHLIGHT_NONE
           
static PdfName HIGHLIGHT_OUTLINE
           
static PdfName HIGHLIGHT_PUSH
           
static PdfName HIGHLIGHT_TOGGLE
           
static int MARKUP_HIGHLIGHT
           
static int MARKUP_STRIKEOUT
           
static int MARKUP_UNDERLINE
           
private  int placeInPage
          Holds value of property placeInPage.
protected  PdfIndirectReference reference
           
protected  HashMap templates
           
protected  boolean used
          Holds value of property used.
protected  PdfWriter writer
           
 
Fields inherited from class com.lowagie.text.pdf.PdfDictionary
CATALOG, FONT, hashMap, OUTLINES, PAGE, PAGES
 
Fields inherited from class com.lowagie.text.pdf.PdfObject
ARRAY, BOOLEAN, bytes, DICTIONARY, INDIRECT, NAME, NOTHING, NULL, NUMBER, STREAM, STRING, TEXT_PDFDOCENCODING, TEXT_UNICODE, type
 
Constructor Summary
  PdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfAction action)
          Constructs a new PdfAnnotation of subtype link (Action).
(package private) PdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfString title, PdfString content)
          Constructs a new PdfAnnotation of subtype text.
protected PdfAnnotation(PdfWriter writer, Rectangle rect)
           
 
Method Summary
static PdfAnnotation createFileAttachment(PdfWriter writer, Rectangle rect, String contents, byte[] fileStore, String file, String fileDisplay)
          Creates a file attachment annotation.
static PdfAnnotation createFreeText(PdfWriter writer, Rectangle rect, String contents, PdfContentByte defaultAppearance)
           
static PdfAnnotation createInk(PdfWriter writer, Rectangle rect, String contents, float[][] inkList)
           
static PdfAnnotation createLine(PdfWriter writer, Rectangle rect, String contents, float x1, float y1, float x2, float y2)
           
protected static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight)
           
static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, int page, PdfDestination dest)
           
static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, PdfAction action)
           
static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, String namedDestination)
           
static PdfAnnotation createMarkup(PdfWriter writer, Rectangle rect, String contents, int type, float[] quadPoints)
           
static PdfAnnotation createPopup(PdfWriter writer, Rectangle rect, String contents, boolean open)
           
static PdfAnnotation createSquareCirlcle(PdfWriter writer, Rectangle rect, String contents, boolean square)
           
static PdfAnnotation createStamp(PdfWriter writer, Rectangle rect, String contents, String name)
           
static PdfAnnotation createText(PdfWriter writer, Rectangle rect, String title, String contents, boolean open, String icon)
           
(package private)  PdfIndirectReference getIndirectReference()
           
 int getPlaceInPage()
          Getter for property placeInPage.
(package private)  HashMap getTemplates()
           
 boolean isAnnotation()
          Getter for property annotation.
 boolean isForm()
          Getter for property form.
 boolean isUsed()
          Getter for property used.
 void setAction(PdfAction action)
           
 void setAdditionalActions(PdfName key, PdfAction action)
           
 void setAppearance(PdfName ap, PdfAppearance template)
           
 void setAppearance(PdfName ap, String state, PdfAppearance template)
           
 void setAppearanceState(String state)
           
 void setBorder(PdfBorderArray border)
           
 void setBorderStyle(PdfBorderDictionary border)
           
 void setColor(Color color)
           
 void setDefaultAppearanceString(PdfContentByte cb)
           
 void setFlags(int flags)
           
 void setPage()
           
 void setPage(int page)
           
 void setPlaceInPage(int placeInPage)
          Places the annotation in a specified page that must be greater or equal to the current one.
 void setPopup(PdfAnnotation popup)
           
 void setTitle(String title)
           
(package private)  void setUsed()
          Setter for property used.
 
Methods inherited from class com.lowagie.text.pdf.PdfDictionary
contains, get, getKeys, isCatalog, isDictionaryType, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putDel, putEx, remove, size, toPdf
 
Methods inherited from class com.lowagie.text.pdf.PdfObject
getBytes, isArray, isBoolean, isDictionary, isName, isNull, isNumber, isStream, isString, length, setContent, toString, type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HIGHLIGHT_NONE

public static final PdfName HIGHLIGHT_NONE

HIGHLIGHT_INVERT

public static final PdfName HIGHLIGHT_INVERT

HIGHLIGHT_OUTLINE

public static final PdfName HIGHLIGHT_OUTLINE

HIGHLIGHT_PUSH

public static final PdfName HIGHLIGHT_PUSH

HIGHLIGHT_TOGGLE

public static final PdfName HIGHLIGHT_TOGGLE

FLAGS_INVISIBLE

public static final int FLAGS_INVISIBLE
See Also:
Constant Field Values

FLAGS_HIDDEN

public static final int FLAGS_HIDDEN
See Also:
Constant Field Values

FLAGS_PRINT

public static final int FLAGS_PRINT
See Also:
Constant Field Values

FLAGS_NOZOOM

public static final int FLAGS_NOZOOM
See Also:
Constant Field Values

FLAGS_NOROTATE

public static final int FLAGS_NOROTATE
See Also:
Constant Field Values

FLAGS_NOVIEW

public static final int FLAGS_NOVIEW
See Also:
Constant Field Values

FLAGS_READONLY

public static final int FLAGS_READONLY
See Also:
Constant Field Values

APPEARANCE_NORMAL

public static final PdfName APPEARANCE_NORMAL

APPEARANCE_ROLLOVER

public static final PdfName APPEARANCE_ROLLOVER

APPEARANCE_DOWN

public static final PdfName APPEARANCE_DOWN

AA_ENTER

public static final PdfName AA_ENTER

AA_EXIT

public static final PdfName AA_EXIT

AA_DOWN

public static final PdfName AA_DOWN

AA_UP

public static final PdfName AA_UP

AA_FOCUS

public static final PdfName AA_FOCUS

AA_BLUR

public static final PdfName AA_BLUR

AA_JS_KEY

public static final PdfName AA_JS_KEY

AA_JS_FORMAT

public static final PdfName AA_JS_FORMAT

AA_JS_CHANGE

public static final PdfName AA_JS_CHANGE

AA_JS_OTHER_CHANGE

public static final PdfName AA_JS_OTHER_CHANGE

MARKUP_HIGHLIGHT

public static final int MARKUP_HIGHLIGHT
See Also:
Constant Field Values

MARKUP_UNDERLINE

public static final int MARKUP_UNDERLINE
See Also:
Constant Field Values

MARKUP_STRIKEOUT

public static final int MARKUP_STRIKEOUT
See Also:
Constant Field Values

writer

protected PdfWriter writer

reference

protected PdfIndirectReference reference

templates

protected HashMap templates

form

protected boolean form

annotation

protected boolean annotation

used

protected boolean used
Holds value of property used.


placeInPage

private int placeInPage
Holds value of property placeInPage.

Constructor Detail

PdfAnnotation

protected PdfAnnotation(PdfWriter writer,
                        Rectangle rect)

PdfAnnotation

PdfAnnotation(PdfWriter writer,
              float llx,
              float lly,
              float urx,
              float ury,
              PdfString title,
              PdfString content)
Constructs a new PdfAnnotation of subtype text.


PdfAnnotation

public PdfAnnotation(PdfWriter writer,
                     float llx,
                     float lly,
                     float urx,
                     float ury,
                     PdfAction action)
Constructs a new PdfAnnotation of subtype link (Action).

Method Detail

getIndirectReference

PdfIndirectReference getIndirectReference()

createText

public static PdfAnnotation createText(PdfWriter writer,
                                       Rectangle rect,
                                       String title,
                                       String contents,
                                       boolean open,
                                       String icon)

createLink

protected static PdfAnnotation createLink(PdfWriter writer,
                                          Rectangle rect,
                                          PdfName highlight)

createLink

public static PdfAnnotation createLink(PdfWriter writer,
                                       Rectangle rect,
                                       PdfName highlight,
                                       PdfAction action)

createLink

public static PdfAnnotation createLink(PdfWriter writer,
                                       Rectangle rect,
                                       PdfName highlight,
                                       String namedDestination)

createLink

public static PdfAnnotation createLink(PdfWriter writer,
                                       Rectangle rect,
                                       PdfName highlight,
                                       int page,
                                       PdfDestination dest)

createFreeText

public static PdfAnnotation createFreeText(PdfWriter writer,
                                           Rectangle rect,
                                           String contents,
                                           PdfContentByte defaultAppearance)

createLine

public static PdfAnnotation createLine(PdfWriter writer,
                                       Rectangle rect,
                                       String contents,
                                       float x1,
                                       float y1,
                                       float x2,
                                       float y2)

createSquareCirlcle

public static PdfAnnotation createSquareCirlcle(PdfWriter writer,
                                                Rectangle rect,
                                                String contents,
                                                boolean square)

createMarkup

public static PdfAnnotation createMarkup(PdfWriter writer,
                                         Rectangle rect,
                                         String contents,
                                         int type,
                                         float[] quadPoints)

createStamp

public static PdfAnnotation createStamp(PdfWriter writer,
                                        Rectangle rect,
                                        String contents,
                                        String name)

createInk

public static PdfAnnotation createInk(PdfWriter writer,
                                      Rectangle rect,
                                      String contents,
                                      float[][] inkList)

createFileAttachment

public static PdfAnnotation createFileAttachment(PdfWriter writer,
                                                 Rectangle rect,
                                                 String contents,
                                                 byte[] fileStore,
                                                 String file,
                                                 String fileDisplay)
                                          throws IOException
Creates a file attachment annotation.

Parameters:
writer - the PdfWriter
rect - the dimensions in the page of the annotation
contents - the file description
fileStore - an array with the file. If it's null the file will be read from the disk
file - the path to the file. It will only be used if fileStore in not null
fileDisplay - the actual file name stored in the pdf
Returns:
the annotation
Throws:
IOException - on error

createPopup

public static PdfAnnotation createPopup(PdfWriter writer,
                                        Rectangle rect,
                                        String contents,
                                        boolean open)

setDefaultAppearanceString

public void setDefaultAppearanceString(PdfContentByte cb)

setFlags

public void setFlags(int flags)

setBorder

public void setBorder(PdfBorderArray border)

setBorderStyle

public void setBorderStyle(PdfBorderDictionary border)

setAppearance

public void setAppearance(PdfName ap,
                          PdfAppearance template)

setAppearance

public void setAppearance(PdfName ap,
                          String state,
                          PdfAppearance template)

setAppearanceState

public void setAppearanceState(String state)

setColor

public void setColor(Color color)

setTitle

public void setTitle(String title)

setPopup

public void setPopup(PdfAnnotation popup)

setAction

public void setAction(PdfAction action)

setAdditionalActions

public void setAdditionalActions(PdfName key,
                                 PdfAction action)

isUsed

public boolean isUsed()
Getter for property used.

Returns:
Value of property used.

setUsed

void setUsed()
Setter for property used.


getTemplates

HashMap getTemplates()

isForm

public boolean isForm()
Getter for property form.

Returns:
Value of property form.

isAnnotation

public boolean isAnnotation()
Getter for property annotation.

Returns:
Value of property annotation.

setPage

public void setPage(int page)

setPage

public void setPage()

getPlaceInPage

public int getPlaceInPage()
Getter for property placeInPage.

Returns:
Value of property placeInPage.

setPlaceInPage

public void setPlaceInPage(int placeInPage)
Places the annotation in a specified page that must be greater or equal to the current one. The first page is 1.

Parameters:
placeInPage - New value of property placeInPage.