Package 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
A
PdfAnnotation is a note that is associated with a page.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class processes links from imported pages so that they may be active. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PdfNameattributevaluestatic final PdfNameattributevaluestatic final PdfNameattributevaluestatic final PdfNameattributevaluestatic final PdfNameattributevaluestatic final PdfNameattributevaluestatic final PdfNameattributevaluestatic final PdfNameattributevaluestatic final PdfNameattributevaluestatic final PdfNameattributevalueprotected booleanstatic final PdfNameappearance attributenamestatic final PdfNameappearance attributenamestatic final PdfNameappearance attributenamestatic final intflagvaluestatic final intflagvaluestatic final intflagvaluestatic final intflagvaluestatic final intflagvaluestatic final intflagvaluestatic final intflagvaluestatic final intflagvaluestatic final intflagvalueprotected booleanstatic final PdfNamehighlight attributenamestatic final PdfNamehighlight attributenamestatic final PdfNamehighlight attributenamestatic final PdfNamehighlight attributenamestatic final PdfNamehighlight attributenamestatic final intattributevaluestatic final intattributevaluestatic final intattributevaluestatic final intattributevalueprotected PdfIndirectReferenceReference to this annotation.protected HashMapprotected booleanHolds value of property used.protected PdfWriter -
Constructor Summary
ConstructorsConstructorDescriptionPdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfAction action) Constructs a newPdfAnnotationof subtype link (Action).PdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfString title, PdfString content) Constructs a newPdfAnnotationof subtype text.PdfAnnotation(PdfWriter writer, Rectangle rect) -
Method Summary
Modifier and TypeMethodDescriptionstatic PdfAnnotationcreateFileAttachment(PdfWriter writer, Rectangle rect, String contents, byte[] fileStore, String file, String fileDisplay) Creates a file attachment annotation.static PdfAnnotationcreateFileAttachment(PdfWriter writer, Rectangle rect, String contents, PdfFileSpecification fs) Creates a file attachment annotationstatic PdfAnnotationcreateFreeText(PdfWriter writer, Rectangle rect, String contents, PdfContentByte defaultAppearance) Add some free text to the document.static PdfAnnotationstatic PdfAnnotationcreateLine(PdfWriter writer, Rectangle rect, String contents, float x1, float y1, float x2, float y2) Adds a line to the document.protected static PdfAnnotationcreateLink(PdfWriter writer, Rectangle rect, PdfName highlight) Creates a link.static PdfAnnotationcreateLink(PdfWriter writer, Rectangle rect, PdfName highlight, int page, PdfDestination dest) Creates an Annotation with a PdfDestination.static PdfAnnotationcreateLink(PdfWriter writer, Rectangle rect, PdfName highlight, PdfAction action) Creates an Annotation with an Action.static PdfAnnotationcreateLink(PdfWriter writer, Rectangle rect, PdfName highlight, String namedDestination) Creates an Annotation with an local destination.static PdfAnnotationcreateMarkup(PdfWriter writer, Rectangle rect, String contents, int type, float[] quadPoints) static PdfAnnotationcreatePopup(PdfWriter writer, Rectangle rect, String contents, boolean open) Adds a popup to your document.static PdfAnnotationcreateScreen(PdfWriter writer, Rectangle rect, String clipTitle, PdfFileSpecification fs, String mimeType, boolean playOnDisplay) Creates a screen PdfAnnotationstatic PdfAnnotationcreateSquareCircle(PdfWriter writer, Rectangle rect, String contents, boolean square) Adds a circle or a square that shows a tooltip when you pass over it.static PdfAnnotationcreateStamp(PdfWriter writer, Rectangle rect, String contents, String name) Adds a Stamp to your document.static PdfAnnotationcreateText(PdfWriter writer, Rectangle rect, String title, String contents, boolean open, String icon) Returns an indirect reference to the annotationstatic PdfArraygetMKColor(Color color) intGetter for property placeInPage.booleanGetter for property annotation.booleanisForm()Getter for property form.booleanisUsed()Getter for property used.voidvoidsetAdditionalActions(PdfName key, PdfAction action) voidsetAppearance(PdfName ap, PdfTemplate template) voidsetAppearance(PdfName ap, String state, PdfTemplate template) voidsetAppearanceState(String state) voidsetBorder(PdfBorderArray border) voidsetBorderStyle(PdfBorderDictionary border) voidvoidvoidsetFlags(int flags) voidsetHighlighting(PdfName highlight) Sets the annotation's highlighting mode.voidSets the layer this annotation belongs to.voidsetMKAlternateCaption(String caption) voidsetMKAlternateIcon(PdfTemplate template) voidsetMKBackgroundColor(Color color) voidsetMKBorderColor(Color color) voidsetMKIconFit(PdfName scale, PdfName scalingType, float leftoverLeft, float leftoverBottom, boolean fitInBounds) voidsetMKNormalCaption(String caption) voidsetMKNormalIcon(PdfTemplate template) voidsetMKRolloverCaption(String caption) voidsetMKRolloverIcon(PdfTemplate template) voidsetMKRotation(int rotation) voidsetMKTextPosition(int tp) voidSets the name of the annotation.voidsetPage()voidsetPage(int page) voidsetPlaceInPage(int placeInPage) Places the annotation in a specified page that must be greater or equal to the current one.voidsetPopup(PdfAnnotation popup) voidsetRotate(int v) voidvoidsetUsed()Setter for property used.Methods inherited from class com.lowagie.text.pdf.PdfDictionary
contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putEx, remove, size, toPdf, toStringMethods inherited from class com.lowagie.text.pdf.PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
-
Field Details
-
HIGHLIGHT_NONE
highlight attributename -
HIGHLIGHT_INVERT
highlight attributename -
HIGHLIGHT_OUTLINE
highlight attributename -
HIGHLIGHT_PUSH
highlight attributename -
HIGHLIGHT_TOGGLE
highlight attributename -
FLAGS_INVISIBLE
public static final int FLAGS_INVISIBLEflagvalue- See Also:
-
FLAGS_HIDDEN
public static final int FLAGS_HIDDENflagvalue- See Also:
-
FLAGS_PRINT
public static final int FLAGS_PRINTflagvalue- See Also:
-
FLAGS_NOZOOM
public static final int FLAGS_NOZOOMflagvalue- See Also:
-
FLAGS_NOROTATE
public static final int FLAGS_NOROTATEflagvalue- See Also:
-
FLAGS_NOVIEW
public static final int FLAGS_NOVIEWflagvalue- See Also:
-
FLAGS_READONLY
public static final int FLAGS_READONLYflagvalue- See Also:
-
FLAGS_LOCKED
public static final int FLAGS_LOCKEDflagvalue- See Also:
-
FLAGS_TOGGLENOVIEW
public static final int FLAGS_TOGGLENOVIEWflagvalue- See Also:
-
APPEARANCE_NORMAL
appearance attributename -
APPEARANCE_ROLLOVER
appearance attributename -
APPEARANCE_DOWN
appearance attributename -
AA_ENTER
attributevalue -
AA_EXIT
attributevalue -
AA_DOWN
attributevalue -
AA_UP
attributevalue -
AA_FOCUS
attributevalue -
AA_BLUR
attributevalue -
AA_JS_KEY
attributevalue -
AA_JS_FORMAT
attributevalue -
AA_JS_CHANGE
attributevalue -
AA_JS_OTHER_CHANGE
attributevalue -
MARKUP_HIGHLIGHT
public static final int MARKUP_HIGHLIGHTattributevalue- See Also:
-
MARKUP_UNDERLINE
public static final int MARKUP_UNDERLINEattributevalue- See Also:
-
MARKUP_STRIKEOUT
public static final int MARKUP_STRIKEOUTattributevalue- See Also:
-
MARKUP_SQUIGGLY
public static final int MARKUP_SQUIGGLYattributevalue- Since:
- 2.1.3
- See Also:
-
writer
-
reference
Reference to this annotation.- Since:
- 2.1.6; was removed in 2.1.5, but restored in 2.1.6
-
templates
-
form
protected boolean form -
annotation
protected boolean annotation -
used
protected boolean usedHolds value of property used.
-
-
Constructor Details
-
PdfAnnotation
-
PdfAnnotation
public PdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfString title, PdfString content) Constructs a newPdfAnnotationof subtype text.- Parameters:
writer-llx-lly-urx-ury-title-content-
-
PdfAnnotation
public PdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfAction action) Constructs a newPdfAnnotationof subtype link (Action).- Parameters:
writer-llx-lly-urx-ury-action-
-
-
Method Details
-
createScreen
public static PdfAnnotation createScreen(PdfWriter writer, Rectangle rect, String clipTitle, PdfFileSpecification fs, String mimeType, boolean playOnDisplay) throws IOException Creates a screen PdfAnnotation- Parameters:
writer-rect-clipTitle-fs-mimeType-playOnDisplay-- Returns:
- a screen PdfAnnotation
- Throws:
IOException
-
getIndirectReference
Returns an indirect reference to the annotation- Returns:
- the indirect reference
-
createText
public static PdfAnnotation createText(PdfWriter writer, Rectangle rect, String title, String contents, boolean open, String icon) - Parameters:
writer-rect-title-contents-open-icon-- Returns:
- a PdfAnnotation
-
createLink
Creates a link.- Parameters:
writer-rect-highlight-- Returns:
- A PdfAnnotation
-
createLink
public static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, PdfAction action) Creates an Annotation with an Action.- Parameters:
writer-rect-highlight-action-- Returns:
- A PdfAnnotation
-
createLink
public static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, String namedDestination) Creates an Annotation with an local destination.- Parameters:
writer-rect-highlight-namedDestination-- Returns:
- A PdfAnnotation
-
createLink
public static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, int page, PdfDestination dest) Creates an Annotation with a PdfDestination.- Parameters:
writer-rect-highlight-page-dest-- Returns:
- A PdfAnnotation
-
createFreeText
public static PdfAnnotation createFreeText(PdfWriter writer, Rectangle rect, String contents, PdfContentByte defaultAppearance) Add some free text to the document.- Parameters:
writer-rect-contents-defaultAppearance-- Returns:
- A PdfAnnotation
-
createLine
public static PdfAnnotation createLine(PdfWriter writer, Rectangle rect, String contents, float x1, float y1, float x2, float y2) Adds a line to the document. Move over the line and a tooltip is shown.- Parameters:
writer-rect-contents-x1-y1-x2-y2-- Returns:
- A PdfAnnotation
-
createSquareCircle
public static PdfAnnotation createSquareCircle(PdfWriter writer, Rectangle rect, String contents, boolean square) Adds a circle or a square that shows a tooltip when you pass over it.- Parameters:
writer-rect-contents- The tooltipsquare- true if you want a square, false if you want a circle- Returns:
- A PdfAnnotation
-
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) Adds a Stamp to your document. Move over the stamp and a tooltip is shown- Parameters:
writer-rect-contents-name-- Returns:
- A PdfAnnotation
-
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- thePdfWriterrect- the dimensions in the page of the annotationcontents- the file descriptionfileStore- an array with the file. If it'snullthe file will be read from the diskfile- the path to the file. It will only be used iffileStoreis notnullfileDisplay- the actual file name stored in the pdf- Returns:
- the annotation
- Throws:
IOException- on error
-
createFileAttachment
public static PdfAnnotation createFileAttachment(PdfWriter writer, Rectangle rect, String contents, PdfFileSpecification fs) throws IOException Creates a file attachment annotation- Parameters:
writer-rect-contents-fs-- Returns:
- the annotation
- Throws:
IOException
-
createPopup
public static PdfAnnotation createPopup(PdfWriter writer, Rectangle rect, String contents, boolean open) Adds a popup to your document.- Parameters:
writer-rect-contents-open-- Returns:
- A PdfAnnotation
-
setDefaultAppearanceString
-
setFlags
public void setFlags(int flags) -
setBorder
-
setBorderStyle
-
setHighlighting
Sets the annotation's highlighting mode. The values can beHIGHLIGHT_NONE,HIGHLIGHT_INVERT,HIGHLIGHT_OUTLINEandHIGHLIGHT_PUSH;- Parameters:
highlight- the annotation's highlighting mode
-
setAppearance
-
setAppearance
-
setAppearanceState
-
setColor
-
setTitle
-
setPopup
-
setAction
-
setAdditionalActions
-
isUsed
public boolean isUsed()Getter for property used.- Returns:
- Value of property used.
-
setUsed
public void setUsed()Setter for property used. -
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. WithPdfStamperthe page can be any. The first page is 1.- Parameters:
placeInPage- New value of property placeInPage.
-
setRotate
public void setRotate(int v) -
setMKRotation
public void setMKRotation(int rotation) -
getMKColor
-
setMKBorderColor
-
setMKBackgroundColor
-
setMKNormalCaption
-
setMKRolloverCaption
-
setMKAlternateCaption
-
setMKNormalIcon
-
setMKRolloverIcon
-
setMKAlternateIcon
-
setMKIconFit
-
setMKTextPosition
public void setMKTextPosition(int tp) -
setLayer
Sets the layer this annotation belongs to.- Parameters:
layer- the layer this annotation belongs to
-
setName
Sets the name of the annotation. With this name the annotation can be identified among all the annotations on a page (it has to be unique).
-