Package com.aowagie.text.pdf
Class PdfAnnotation
java.lang.Object
com.aowagie.text.pdf.PdfObject
com.aowagie.text.pdf.PdfDictionary
com.aowagie.text.pdf.PdfAnnotation
- Direct Known Subclasses:
PdfFormField
A
PdfAnnotation
is a note that is associated with a page.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
(package private) static final PdfName
appearance attributename(package private) static final int
flagvalue(package private) static final int
flagvalue(package private) static final int
flagvaluestatic final int
flagvalueprotected boolean
(package private) static final PdfName
highlight attributename(package private) static final PdfName
highlight attributenameprivate static final int
attributevalueprivate static final int
attributevalueprivate static final int
attributevalueprivate int
Holds value of property placeInPage.private PdfIndirectReference
Reference to this annotation.protected HashMap
protected boolean
Holds value of property used.protected PdfWriter
Fields inherited from class com.aowagie.text.pdf.PdfDictionary
CATALOG, hashMap, OUTLINES, PAGE
Fields inherited from class com.aowagie.text.pdf.PdfObject
ARRAY, BOOLEAN, bytes, DICTIONARY, INDIRECT, NAME, NOTHING, NULL, NUMBER, STREAM, STRING, TEXT_PDFDOCENCODING, TEXT_UNICODE, type
-
Constructor Summary
ConstructorsConstructorDescriptionPdfAnnotation
(PdfWriter writer, float llx, float lly, float urx, float ury, PdfAction action) Constructs a newPdfAnnotation
of subtype link (Action).PdfAnnotation
(PdfWriter writer, float llx, float lly, float urx, float ury, PdfString title, PdfString content) Constructs a newPdfAnnotation
of subtype text.PdfAnnotation
(PdfWriter writer, Rectangle rect) -
Method Summary
Modifier and TypeMethodDescriptionprivate static PdfAnnotation
createFileAttachment
(PdfWriter writer, Rectangle rect, String contents, PdfFileSpecification fs) Creates a file attachment annotationprivate static PdfAnnotation
createLink
(PdfWriter writer, Rectangle rect, PdfName highlight) Creates a link.static PdfAnnotation
createScreen
(PdfWriter writer, Rectangle rect, String clipTitle, PdfFileSpecification fs, String mimeType, boolean playOnDisplay) Creates a screen PdfAnnotationReturns an indirect reference to the annotationprivate PdfDictionary
getMK()
(package private) static PdfArray
getMKColor
(Color color) int
Getter for property placeInPage.boolean
Getter for property annotation.boolean
isForm()
Getter for property form.boolean
isUsed()
Getter for property used.void
(package private) void
setAppearance
(PdfName ap, PdfTemplate template) (package private) void
setAppearance
(PdfName ap, String state, PdfTemplate template) void
setAppearanceState
(String state) void
setBorder
(PdfBorderArray border) void
setBorderStyle
(PdfBorderDictionary border) void
void
void
setFlags
(int flags) void
setHighlighting
(PdfName highlight) Sets the annotation's highlighting mode.void
Sets the layer this annotation belongs to.void
setMKAlternateCaption
(String caption) void
setMKAlternateIcon
(PdfTemplate template) void
setMKBackgroundColor
(Color color) void
setMKBorderColor
(Color color) (package private) void
setMKIconFit
(PdfName scale, PdfName scalingType, float leftoverLeft, float leftoverBottom, boolean fitInBounds) void
setMKNormalCaption
(String caption) void
setMKNormalIcon
(PdfTemplate template) void
setMKRolloverCaption
(String caption) void
setMKRolloverIcon
(PdfTemplate template) void
setMKRotation
(int rotation) void
setMKTextPosition
(int tp) void
Sets the name of the annotation.(package private) 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
setRotate
(int v) void
void
setUsed()
Setter for property used.Methods inherited from class com.aowagie.text.pdf.PdfDictionary
contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, remove, size, toPdf, toString
Methods inherited from class com.aowagie.text.pdf.PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, setContent, setIndRef, type
-
Field Details
-
HIGHLIGHT_INVERT
highlight attributename -
HIGHLIGHT_TOGGLE
highlight attributename -
FLAGS_HIDDEN
static final int FLAGS_HIDDENflagvalue- See Also:
-
FLAGS_PRINT
public static final int FLAGS_PRINTflagvalue- See Also:
-
FLAGS_NOVIEW
static final int FLAGS_NOVIEWflagvalue- See Also:
-
FLAGS_LOCKED
static final int FLAGS_LOCKEDflagvalue- See Also:
-
APPEARANCE_NORMAL
appearance attributename -
MARKUP_UNDERLINE
private static final int MARKUP_UNDERLINEattributevalue- See Also:
-
MARKUP_STRIKEOUT
private static final int MARKUP_STRIKEOUTattributevalue- See Also:
-
MARKUP_SQUIGGLY
private 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. -
placeInPage
private int placeInPageHolds value of property placeInPage.
-
-
Constructor Details
-
PdfAnnotation
-
PdfAnnotation
public PdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfString title, PdfString content) Constructs a newPdfAnnotation
of subtype text.- Parameters:
writer
- writer to putllx
- position llx to putlly
- position lly to puturx
- position urx to putury
- position ury to puttitle
- title to putcontent
- content to put
-
PdfAnnotation
public PdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfAction action) Constructs a newPdfAnnotation
of subtype link (Action).- Parameters:
writer
- writer to putllx
- position llx to putlly
- position lly to puturx
- position urx to putury
- position ury to putaction
- action to put
-
-
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
- Writer to createrect
- Rectangle to createclipTitle
- Cliptitle to createfs
- FileSpecification to createmimeType
- Mimetype to setplayOnDisplay
- PlayOnDisplay to set- Returns:
- a screen PdfAnnotation
- Throws:
IOException
- Exception of a I/O
-
getIndirectReference
Returns an indirect reference to the annotation- Returns:
- the indirect reference
-
createLink
Creates a link.- Parameters:
writer
-rect
-highlight
-- Returns:
- A PdfAnnotation
-
createFileAttachment
private 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
-
setDefaultAppearanceString
-
setFlags
public void setFlags(int flags) -
setBorder
-
setBorderStyle
-
setHighlighting
Sets the annotation's highlighting mode. The values can beHIGHLIGHT_NONE
,HIGHLIGHT_INVERT
,HIGHLIGHT_OUTLINE
andHIGHLIGHT_PUSH
;- Parameters:
highlight
- the annotation's highlighting mode
-
setAppearance
-
setAppearance
-
setAppearanceState
-
setColor
-
setTitle
-
setPopup
-
setAction
-
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
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. WithPdfStamper
the page can be any. The first page is 1.- Parameters:
placeInPage
- New value of property placeInPage.
-
setRotate
public void setRotate(int v) -
getMK
-
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).- Parameters:
name
- name to set
-