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
public class PdfAnnotation extends PdfDictionary
APdfAnnotationis a note that is associated with a page.- See Also:
PdfDictionary
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanannotation(package private) static PdfNameAPPEARANCE_NORMALappearance attributename(package private) static intFLAGS_HIDDENflagvalue(package private) static intFLAGS_LOCKEDflagvalue(package private) static intFLAGS_NOVIEWflagvaluestatic intFLAGS_PRINTflagvalueprotected booleanform(package private) static PdfNameHIGHLIGHT_INVERThighlight attributename(package private) static PdfNameHIGHLIGHT_TOGGLEhighlight attributenameprivate static intMARKUP_SQUIGGLYattributevalueprivate static intMARKUP_STRIKEOUTattributevalueprivate static intMARKUP_UNDERLINEattributevalueprivate intplaceInPageHolds value of property placeInPage.private PdfIndirectReferencereferenceReference to this annotation.protected java.util.HashMaptemplatesprotected booleanusedHolds value of property used.protected PdfWriterwriter-
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
Constructors Constructor Description PdfAnnotation(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static PdfAnnotationcreateFileAttachment(PdfWriter writer, Rectangle rect, java.lang.String contents, PdfFileSpecification fs)Creates a file attachment annotationprivate static PdfAnnotationcreateLink(PdfWriter writer, Rectangle rect, PdfName highlight)Creates a link.static PdfAnnotationcreateScreen(PdfWriter writer, Rectangle rect, java.lang.String clipTitle, PdfFileSpecification fs, java.lang.String mimeType, boolean playOnDisplay)Creates a screen PdfAnnotationPdfIndirectReferencegetIndirectReference()Returns an indirect reference to the annotationprivate PdfDictionarygetMK()(package private) static PdfArraygetMKColor(java.awt.Color color)intgetPlaceInPage()Getter for property placeInPage.java.util.HashMapgetTemplates()booleanisAnnotation()Getter for property annotation.booleanisForm()Getter for property form.booleanisUsed()Getter for property used.voidsetAction(PdfAction action)(package private) voidsetAppearance(PdfName ap, PdfTemplate template)(package private) voidsetAppearance(PdfName ap, java.lang.String state, PdfTemplate template)voidsetAppearanceState(java.lang.String state)voidsetBorder(PdfBorderArray border)voidsetBorderStyle(PdfBorderDictionary border)voidsetColor(java.awt.Color color)voidsetDefaultAppearanceString(PdfContentByte cb)voidsetFlags(int flags)voidsetHighlighting(PdfName highlight)Sets the annotation's highlighting mode.voidsetLayer(PdfOCG layer)Sets the layer this annotation belongs to.voidsetMKAlternateCaption(java.lang.String caption)voidsetMKAlternateIcon(PdfTemplate template)voidsetMKBackgroundColor(java.awt.Color color)voidsetMKBorderColor(java.awt.Color color)(package private) voidsetMKIconFit(PdfName scale, PdfName scalingType, float leftoverLeft, float leftoverBottom, boolean fitInBounds)voidsetMKNormalCaption(java.lang.String caption)voidsetMKNormalIcon(PdfTemplate template)voidsetMKRolloverCaption(java.lang.String caption)voidsetMKRolloverIcon(PdfTemplate template)voidsetMKRotation(int rotation)voidsetMKTextPosition(int tp)voidsetName(java.lang.String name)Sets the name of the annotation.(package private) 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)voidsetTitle(java.lang.String title)voidsetUsed()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 Detail
-
HIGHLIGHT_INVERT
static final PdfName HIGHLIGHT_INVERT
highlight attributename
-
HIGHLIGHT_TOGGLE
static final PdfName HIGHLIGHT_TOGGLE
highlight attributename
-
FLAGS_HIDDEN
static final int FLAGS_HIDDEN
flagvalue- See Also:
- Constant Field Values
-
FLAGS_PRINT
public static final int FLAGS_PRINT
flagvalue- See Also:
- Constant Field Values
-
FLAGS_NOVIEW
static final int FLAGS_NOVIEW
flagvalue- See Also:
- Constant Field Values
-
FLAGS_LOCKED
static final int FLAGS_LOCKED
flagvalue- See Also:
- Constant Field Values
-
APPEARANCE_NORMAL
static final PdfName APPEARANCE_NORMAL
appearance attributename
-
MARKUP_UNDERLINE
private static final int MARKUP_UNDERLINE
attributevalue- See Also:
- Constant Field Values
-
MARKUP_STRIKEOUT
private static final int MARKUP_STRIKEOUT
attributevalue- See Also:
- Constant Field Values
-
MARKUP_SQUIGGLY
private static final int MARKUP_SQUIGGLY
attributevalue- Since:
- 2.1.3
- See Also:
- Constant Field Values
-
writer
protected PdfWriter writer
-
reference
private PdfIndirectReference reference
Reference to this annotation.- Since:
- 2.1.6; was removed in 2.1.5, but restored in 2.1.6
-
templates
protected java.util.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
public PdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfString title, PdfString content)
Constructs a newPdfAnnotationof 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 newPdfAnnotationof 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 Detail
-
createScreen
public static PdfAnnotation createScreen(PdfWriter writer, Rectangle rect, java.lang.String clipTitle, PdfFileSpecification fs, java.lang.String mimeType, boolean playOnDisplay) throws java.io.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:
java.io.IOException- Exception of a I/O
-
getIndirectReference
public PdfIndirectReference getIndirectReference()
Returns an indirect reference to the annotation- Returns:
- the indirect reference
-
createLink
private static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight)
Creates a link.- Parameters:
writer-rect-highlight-- Returns:
- A PdfAnnotation
-
createFileAttachment
private static PdfAnnotation createFileAttachment(PdfWriter writer, Rectangle rect, java.lang.String contents, PdfFileSpecification fs) throws java.io.IOException
Creates a file attachment annotation- Parameters:
writer-rect-contents-fs-- Returns:
- the annotation
- Throws:
java.io.IOException
-
setDefaultAppearanceString
public void setDefaultAppearanceString(PdfContentByte cb)
-
setFlags
public void setFlags(int flags)
-
setBorder
public void setBorder(PdfBorderArray border)
-
setBorderStyle
public void setBorderStyle(PdfBorderDictionary border)
-
setHighlighting
public void setHighlighting(PdfName highlight)
Sets the annotation's highlighting mode. The values can beHIGHLIGHT_NONE,HIGHLIGHT_INVERT,HIGHLIGHT_OUTLINEandHIGHLIGHT_PUSH;- Parameters:
highlight- the annotation's highlighting mode
-
setAppearance
void setAppearance(PdfName ap, PdfTemplate template)
-
setAppearance
void setAppearance(PdfName ap, java.lang.String state, PdfTemplate template)
-
setAppearanceState
public void setAppearanceState(java.lang.String state)
-
setColor
public void setColor(java.awt.Color color)
-
setTitle
public void setTitle(java.lang.String title)
-
setPopup
public void setPopup(PdfAnnotation popup)
-
setAction
public void setAction(PdfAction action)
-
isUsed
public boolean isUsed()
Getter for property used.- Returns:
- Value of property used.
-
setUsed
public void setUsed()
Setter for property used.
-
getTemplates
public java.util.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
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)
-
getMK
private PdfDictionary getMK()
-
setMKRotation
public void setMKRotation(int rotation)
-
getMKColor
static PdfArray getMKColor(java.awt.Color color)
-
setMKBorderColor
public void setMKBorderColor(java.awt.Color color)
-
setMKBackgroundColor
public void setMKBackgroundColor(java.awt.Color color)
-
setMKNormalCaption
public void setMKNormalCaption(java.lang.String caption)
-
setMKRolloverCaption
public void setMKRolloverCaption(java.lang.String caption)
-
setMKAlternateCaption
public void setMKAlternateCaption(java.lang.String caption)
-
setMKNormalIcon
public void setMKNormalIcon(PdfTemplate template)
-
setMKRolloverIcon
public void setMKRolloverIcon(PdfTemplate template)
-
setMKAlternateIcon
public void setMKAlternateIcon(PdfTemplate template)
-
setMKIconFit
void setMKIconFit(PdfName scale, PdfName scalingType, float leftoverLeft, float leftoverBottom, boolean fitInBounds)
-
setMKTextPosition
public void setMKTextPosition(int tp)
-
setLayer
public void setLayer(PdfOCG layer)
Sets the layer this annotation belongs to.- Parameters:
layer- the layer this annotation belongs to
-
setName
public void setName(java.lang.String name)
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
-
-