public class PdfAnnotation extends PdfDictionary
PdfAnnotation
is a note that is associated with a page.PdfDictionary
Modifier and Type | Class and Description |
---|---|
static class |
PdfAnnotation.PdfImportedLink
This class processes links from imported pages so that they may be active.
|
Modifier and Type | Field and Description |
---|---|
static PdfName |
AA_BLUR
attributevalue
|
static PdfName |
AA_DOWN
attributevalue
|
static PdfName |
AA_ENTER
attributevalue
|
static PdfName |
AA_EXIT
attributevalue
|
static PdfName |
AA_FOCUS
attributevalue
|
static PdfName |
AA_JS_CHANGE
attributevalue
|
static PdfName |
AA_JS_FORMAT
attributevalue
|
static PdfName |
AA_JS_KEY
attributevalue
|
static PdfName |
AA_JS_OTHER_CHANGE
attributevalue
|
static PdfName |
AA_UP
attributevalue
|
protected boolean |
annotation |
static PdfName |
APPEARANCE_DOWN
appearance attributename
|
static PdfName |
APPEARANCE_NORMAL
appearance attributename
|
static PdfName |
APPEARANCE_ROLLOVER
appearance attributename
|
static int |
FLAGS_HIDDEN
flagvalue
|
static int |
FLAGS_INVISIBLE
flagvalue
|
static int |
FLAGS_LOCKED
flagvalue
|
static int |
FLAGS_NOROTATE
flagvalue
|
static int |
FLAGS_NOVIEW
flagvalue
|
static int |
FLAGS_NOZOOM
flagvalue
|
static int |
FLAGS_PRINT
flagvalue
|
static int |
FLAGS_READONLY
flagvalue
|
static int |
FLAGS_TOGGLENOVIEW
flagvalue
|
protected boolean |
form |
static PdfName |
HIGHLIGHT_INVERT
highlight attributename
|
static PdfName |
HIGHLIGHT_NONE
highlight attributename
|
static PdfName |
HIGHLIGHT_OUTLINE
highlight attributename
|
static PdfName |
HIGHLIGHT_PUSH
highlight attributename
|
static PdfName |
HIGHLIGHT_TOGGLE
highlight attributename
|
static int |
MARKUP_HIGHLIGHT
attributevalue
|
static int |
MARKUP_SQUIGGLY
attributevalue
|
static int |
MARKUP_STRIKEOUT
attributevalue
|
static int |
MARKUP_UNDERLINE
attributevalue
|
protected PdfIndirectReference |
reference
Reference to this annotation.
|
protected Map<PdfTemplate,Object> |
templates |
protected boolean |
used
Holds value of property used.
|
protected PdfWriter |
writer |
Constructor and Description |
---|
PdfAnnotation(PdfWriter writer,
float llx,
float lly,
float urx,
float ury,
PdfAction action)
Constructs a new
PdfAnnotation of subtype link (Action). |
PdfAnnotation(PdfWriter writer,
float llx,
float lly,
float urx,
float ury,
PdfString title,
PdfString content)
Constructs a new
PdfAnnotation of subtype text. |
PdfAnnotation(PdfWriter writer,
Rectangle rect) |
Modifier and Type | Method and Description |
---|---|
static PdfAnnotation |
createFileAttachment(PdfWriter writer,
Rectangle rect,
String contents,
byte[] fileStore,
String file,
String fileDisplay)
Creates a file attachment annotation.
|
static PdfAnnotation |
createFileAttachment(PdfWriter writer,
Rectangle rect,
String contents,
PdfFileSpecification fs)
Creates a file attachment annotation
|
static PdfAnnotation |
createFreeText(PdfWriter writer,
Rectangle rect,
String contents,
PdfContentByte defaultAppearance)
Add some free text to the document.
|
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)
Adds a line to the document.
|
protected static PdfAnnotation |
createLink(PdfWriter writer,
Rectangle rect,
PdfName highlight)
Creates a link.
|
static PdfAnnotation |
createLink(PdfWriter writer,
Rectangle rect,
PdfName highlight,
int page,
PdfDestination dest)
Creates an Annotation with a PdfDestination.
|
static PdfAnnotation |
createLink(PdfWriter writer,
Rectangle rect,
PdfName highlight,
PdfAction action)
Creates an Annotation with an Action.
|
static PdfAnnotation |
createLink(PdfWriter writer,
Rectangle rect,
PdfName highlight,
String namedDestination)
Creates an Annotation with an local destination.
|
static PdfAnnotation |
createMarkup(PdfWriter writer,
Rectangle rect,
String contents,
int type,
float[] quadPoints) |
static PdfAnnotation |
createPopup(PdfWriter writer,
Rectangle rect,
String contents,
boolean open)
Adds a popup to your document.
|
static PdfAnnotation |
createScreen(PdfWriter writer,
Rectangle rect,
String clipTitle,
PdfFileSpecification fs,
String mimeType,
boolean playOnDisplay)
Creates a screen PdfAnnotation
|
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.
|
static PdfAnnotation |
createStamp(PdfWriter writer,
Rectangle rect,
String contents,
String name)
Adds a Stamp to your document.
|
static PdfAnnotation |
createText(PdfWriter writer,
Rectangle rect,
String title,
String contents,
boolean open,
String icon) |
PdfIndirectReference |
getIndirectReference()
Returns an indirect reference to the annotation
|
static PdfArray |
getMKColor(Color color) |
int |
getPlaceInPage()
Getter for property placeInPage.
|
HashMap<PdfTemplate,Object> |
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,
PdfTemplate template) |
void |
setAppearance(PdfName ap,
String state,
PdfTemplate 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 |
setHighlighting(PdfName highlight)
Sets the annotation's highlighting mode.
|
void |
setLayer(PdfOCG layer)
Sets the layer this annotation belongs to.
|
void |
setMKAlternateCaption(String caption) |
void |
setMKAlternateIcon(PdfTemplate template) |
void |
setMKBackgroundColor(Color color) |
void |
setMKBorderColor(Color color) |
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 |
setName(String name)
Sets the name of the annotation.
|
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 |
setTitle(String title) |
void |
setUsed()
Setter for property used.
|
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, toString
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
public static final PdfName HIGHLIGHT_NONE
public static final PdfName HIGHLIGHT_INVERT
public static final PdfName HIGHLIGHT_OUTLINE
public static final PdfName HIGHLIGHT_PUSH
public static final PdfName HIGHLIGHT_TOGGLE
public static final int FLAGS_INVISIBLE
public static final int FLAGS_HIDDEN
public static final int FLAGS_PRINT
public static final int FLAGS_NOZOOM
public static final int FLAGS_NOROTATE
public static final int FLAGS_NOVIEW
public static final int FLAGS_READONLY
public static final int FLAGS_LOCKED
public static final int FLAGS_TOGGLENOVIEW
public static final PdfName APPEARANCE_NORMAL
public static final PdfName APPEARANCE_ROLLOVER
public static final PdfName APPEARANCE_DOWN
public static final PdfName AA_ENTER
public static final PdfName AA_EXIT
public static final PdfName AA_DOWN
public static final PdfName AA_UP
public static final PdfName AA_FOCUS
public static final PdfName AA_BLUR
public static final PdfName AA_JS_KEY
public static final PdfName AA_JS_FORMAT
public static final PdfName AA_JS_CHANGE
public static final PdfName AA_JS_OTHER_CHANGE
public static final int MARKUP_HIGHLIGHT
public static final int MARKUP_UNDERLINE
public static final int MARKUP_STRIKEOUT
public static final int MARKUP_SQUIGGLY
protected PdfWriter writer
protected PdfIndirectReference reference
protected Map<PdfTemplate,Object> templates
protected boolean form
protected boolean annotation
protected boolean used
public PdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfString title, PdfString content)
PdfAnnotation
of subtype text.writer
- pdf writerllx
- lower-left-xlly
- lower-left-yurx
- upper-right-xury
- upper-right-ytitle
- titlecontent
- contentpublic PdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfAction action)
PdfAnnotation
of subtype link (Action).writer
- pdf writerllx
- lower-left-xlly
- lower-left-yurx
- upper-right-xury
- upper-right-yaction
- PdfAction
public static PdfAnnotation createScreen(PdfWriter writer, Rectangle rect, String clipTitle, PdfFileSpecification fs, String mimeType, boolean playOnDisplay) throws IOException
writer
- PdfWriter
rect
- dimensions Rectangle
clipTitle
- clip titlefs
- PdfFileSpecification
mimeType
- mime type of the fileplayOnDisplay
- play on displayIOException
- on errorpublic PdfIndirectReference getIndirectReference()
public static PdfAnnotation createText(PdfWriter writer, Rectangle rect, String title, String contents, boolean open, String icon)
protected static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight)
public static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, PdfAction action)
public static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, String namedDestination)
public static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, int page, PdfDestination dest)
public static PdfAnnotation createFreeText(PdfWriter writer, Rectangle rect, String contents, PdfContentByte defaultAppearance)
writer
- pdf writerrect
- dimensioncontents
- content of free textdefaultAppearance
- default appearancepublic static PdfAnnotation createLine(PdfWriter writer, Rectangle rect, String contents, float x1, float y1, float x2, float y2)
public static PdfAnnotation createSquareCircle(PdfWriter writer, Rectangle rect, String contents, boolean square)
writer
- pdf writerrect
- dimension of the tooltipcontents
- The tooltipsquare
- true if you want a square, false if you want a circlepublic static PdfAnnotation createMarkup(PdfWriter writer, Rectangle rect, String contents, int type, float[] quadPoints)
public static PdfAnnotation createStamp(PdfWriter writer, Rectangle rect, String contents, String name)
public static PdfAnnotation createInk(PdfWriter writer, Rectangle rect, String contents, float[][] inkList)
public static PdfAnnotation createFileAttachment(PdfWriter writer, Rectangle rect, String contents, byte[] fileStore, String file, String fileDisplay) throws IOException
writer
- the PdfWriter
rect
- the dimensions in the page of the annotationcontents
- the file descriptionfileStore
- an array with the file. If it's null
the file will be read from the diskfile
- the path to the file. It will only be used if
fileStore
is not null
fileDisplay
- the actual file name stored in the pdfIOException
- on errorpublic static PdfAnnotation createFileAttachment(PdfWriter writer, Rectangle rect, String contents, PdfFileSpecification fs) throws IOException
writer
- PdfWriter
rect
- dimensions Rectangle
contents
- content for the filefs
- PdfFileSpecification
IOException
- on errorpublic static PdfAnnotation createPopup(PdfWriter writer, Rectangle rect, String contents, boolean open)
public void setDefaultAppearanceString(PdfContentByte cb)
public void setFlags(int flags)
public void setBorder(PdfBorderArray border)
public void setBorderStyle(PdfBorderDictionary border)
public void setHighlighting(PdfName highlight)
HIGHLIGHT_NONE
, HIGHLIGHT_INVERT
,
HIGHLIGHT_OUTLINE
and HIGHLIGHT_PUSH
;highlight
- the annotation's highlighting modepublic void setAppearance(PdfName ap, PdfTemplate template)
public void setAppearance(PdfName ap, String state, PdfTemplate template)
public void setAppearanceState(String state)
public void setColor(Color color)
public void setTitle(String title)
public void setPopup(PdfAnnotation popup)
public void setAction(PdfAction action)
public boolean isUsed()
public void setUsed()
public HashMap<PdfTemplate,Object> getTemplates()
public boolean isForm()
public boolean isAnnotation()
public void setPage(int page)
public void setPage()
public int getPlaceInPage()
public void setPlaceInPage(int placeInPage)
PdfStamper
the page can
be any. The first page is 1.placeInPage
- New value of property placeInPage.public void setRotate(int v)
public void setMKRotation(int rotation)
public void setMKBorderColor(Color color)
public void setMKBackgroundColor(Color color)
public void setMKNormalCaption(String caption)
public void setMKRolloverCaption(String caption)
public void setMKAlternateCaption(String caption)
public void setMKNormalIcon(PdfTemplate template)
public void setMKRolloverIcon(PdfTemplate template)
public void setMKAlternateIcon(PdfTemplate template)
public void setMKIconFit(PdfName scale, PdfName scalingType, float leftoverLeft, float leftoverBottom, boolean fitInBounds)
public void setMKTextPosition(int tp)
public void setLayer(PdfOCG layer)
layer
- the layer this annotation belongs topublic void setName(String name)
name
- name to be set for annotationCopyright © 2020. All rights reserved.