Package com.itextpdf.kernel.pdf.annot
Class PdfMarkupAnnotation
- java.lang.Object
-
- com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
-
- com.itextpdf.kernel.pdf.annot.PdfAnnotation
-
- com.itextpdf.kernel.pdf.annot.PdfMarkupAnnotation
-
- Direct Known Subclasses:
PdfCaretAnnotation
,PdfCircleAnnotation
,PdfFileAttachmentAnnotation
,PdfFreeTextAnnotation
,PdfInkAnnotation
,PdfLineAnnotation
,PdfPolyGeomAnnotation
,PdfRedactAnnotation
,PdfSoundAnnotation
,PdfSquareAnnotation
,PdfStampAnnotation
,PdfTextAnnotation
,PdfTextMarkupAnnotation
public abstract class PdfMarkupAnnotation extends PdfAnnotation
This is a super class for the annotations which are defined as markup annotations because they are used primarily to mark up PDF documents. These annotations have text that appears as part of the annotation and may be displayed in other ways by a conforming reader, such as in a Comments pane. See also ISO-320001 12.5.6.2 "Markup Annotations".
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
PdfAnnotation.PdfUnknownAnnotation
-
-
Field Summary
Fields Modifier and Type Field Description protected PdfAnnotation
inReplyTo
protected PdfPopupAnnotation
popup
-
Fields inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
Accepted, Canceled, Completed, HIDDEN, HIGHLIGHT_INVERT, HIGHLIGHT_NONE, HIGHLIGHT_OUTLINE, HIGHLIGHT_PUSH, HIGHLIGHT_TOGGLE, INVISIBLE, LOCKED, LOCKED_CONTENTS, Marked, MarkedModel, NO_ROTATE, NO_VIEW, NO_ZOOM, None, page, PRINT, READ_ONLY, Rejected, ReviewModel, STYLE_BEVELED, STYLE_DASHED, STYLE_INSET, STYLE_SOLID, STYLE_UNDERLINE, TOGGLE_NO_VIEW, Unmarked
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PdfMarkupAnnotation(Rectangle rect)
protected
PdfMarkupAnnotation(PdfDictionary pdfObject)
Instantiates a newPdfMarkupAnnotation
instance based onPdfDictionary
instance, that represents existing annotation object in the document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PdfString
getCreationDate()
The date and time when the annotation was created.PdfDictionary
getExternalData()
An external data dictionary specifying data that shall be associated with the annotation.PdfAnnotation
getInReplyTo()
An annotation that this annotation is "in reply to." Both annotations shall be on the same page of the document.PdfDictionary
getInReplyToObject()
An annotation object that this annotation is "in reply to." Both annotations shall be on the same page of the document.PdfName
getIntent()
A name describing the intent of the markup annotation.PdfNumber
getOpacity()
The constant opacity value that will be used in painting the annotation.PdfPopupAnnotation
getPopup()
An associated pop-up annotation for entering or editing the text associated with this annotation.PdfDictionary
getPopupObject()
An associated pop-up annotation object.PdfName
getReplyType()
A name specifying the relationship (the "reply type") between this annotation and one specified by IRT entry (seegetInReplyTo()
).PdfObject
getRichText()
A rich text string (see ISO-320001 12.7.3.4, "Rich Text Strings") that shall be displayed in the pop-up window when the annotation is opened.PdfString
getSubject()
Text representing a short description of the subject being addressed by the annotation.PdfString
getText()
The text label that will be displayed in the title bar of the annotation's pop-up window when open and active.PdfMarkupAnnotation
setCreationDate(PdfString creationDate)
Sets the date and time when the annotation was created.PdfMarkupAnnotation
setExternalData(PdfDictionary exData)
Sets an external data dictionary specifying data that shall be associated with the annotation.PdfMarkupAnnotation
setInReplyTo(PdfAnnotation inReplyTo)
Sets an annotation that this annotation is "in reply to." Both annotations shall be on the same page of the document.PdfMarkupAnnotation
setIntent(PdfName intent)
Sets a name describing the intent of the markup annotation.PdfMarkupAnnotation
setOpacity(PdfNumber ca)
Sets the constant opacity value that will be used in painting the annotation.PdfMarkupAnnotation
setPopup(PdfPopupAnnotation popup)
Sets a pop-up annotation for entering or editing the text associated with this annotation.PdfMarkupAnnotation
setReplyType(PdfName replyType)
Sets the relationship (the "reply type") between this annotation and one specified by IRT entry (seesetInReplyTo(PdfAnnotation)
).PdfMarkupAnnotation
setRichText(PdfObject richText)
Sets a rich text string (see ISO-320001 12.7.3.4, "Rich Text Strings") that shall be displayed in the pop-up window when the annotation is opened.PdfMarkupAnnotation
setSubject(PdfString subject)
Sets the text representing a short description of the subject being addressed by the annotation.PdfMarkupAnnotation
setText(PdfString text)
Sets the text label that will be displayed in the title bar of the annotation's pop-up window when open and active.-
Methods inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
addAssociatedFile, flush, getAppearanceDictionary, getAppearanceObject, getAppearanceState, getAssociatedFiles, getBlendMode, getBorder, getColorObject, getContents, getDate, getDownAppearanceObject, getFlags, getLang, getName, getNonStrokingOpacity, getNormalAppearanceObject, getPage, getPageObject, getRectangle, getRolloverAppearanceObject, getStrokingOpacity, getStructParentIndex, getSubtype, getTitle, hasFlag, isWrappedObjectMustBeIndirect, makeAnnotation, put, remove, resetFlag, setAppearance, setAppearance, setAppearanceState, setBlendMode, setBorder, setBorder, setColor, setColor, setColor, setContents, setContents, setDate, setDownAppearance, setDownAppearance, setFlag, setFlags, setLang, setLayer, setName, setNonStrokingOpacity, setNormalAppearance, setNormalAppearance, setPage, setRectangle, setRolloverAppearance, setRolloverAppearance, setStrokingOpacity, setStructParentIndex, setTitle
-
Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
-
-
-
Field Detail
-
inReplyTo
protected PdfAnnotation inReplyTo
-
popup
protected PdfPopupAnnotation popup
-
-
Constructor Detail
-
PdfMarkupAnnotation
protected PdfMarkupAnnotation(Rectangle rect)
-
PdfMarkupAnnotation
protected PdfMarkupAnnotation(PdfDictionary pdfObject)
Instantiates a newPdfMarkupAnnotation
instance based onPdfDictionary
instance, that represents existing annotation object in the document.- Parameters:
pdfObject
- thePdfDictionary
representing annotation object- See Also:
PdfAnnotation.makeAnnotation(PdfObject)
-
-
Method Detail
-
getText
public PdfString getText()
The text label that will be displayed in the title bar of the annotation's pop-up window when open and active. This entry shall identify the user who added the annotation.- Returns:
PdfString
which value is an annotation text label content or null if text is not specified.
-
setText
public PdfMarkupAnnotation setText(PdfString text)
Sets the text label that will be displayed in the title bar of the annotation's pop-up window when open and active. This entry shall identify the user who added the annotation.- Parameters:
text
-PdfString
which value is an annotation text label content.- Returns:
- this
PdfMarkupAnnotation
instance.
-
getOpacity
public PdfNumber getOpacity()
The constant opacity value that will be used in painting the annotation. This value is applied to all visible elements of the annotation in its closed state (including its background and border) but not to the pop-up window that appears when the annotation is opened. Default value: 1.0.- Returns:
- a
PdfNumber
which value is in range between 0 and 1, which specifies the level of opacity. This method returns null if opacity is not specified; in this case default value is used, which is 1.
-
setOpacity
public PdfMarkupAnnotation setOpacity(PdfNumber ca)
Sets the constant opacity value that will be used in painting the annotation.- Parameters:
ca
- aPdfNumber
which value is in range between 0 and 1, which specifies the level of opacity.- Returns:
- this
PdfMarkupAnnotation
instance. - See Also:
getOpacity()
-
getRichText
public PdfObject getRichText()
A rich text string (see ISO-320001 12.7.3.4, "Rich Text Strings") that shall be displayed in the pop-up window when the annotation is opened.- Returns:
- text string or text stream that specifies rich text or null if rich text is not specified.
-
setRichText
public PdfMarkupAnnotation setRichText(PdfObject richText)
Sets a rich text string (see ISO-320001 12.7.3.4, "Rich Text Strings") that shall be displayed in the pop-up window when the annotation is opened.- Parameters:
richText
- text string or text stream that specifies rich text.- Returns:
- this
PdfMarkupAnnotation
instance.
-
getCreationDate
public PdfString getCreationDate()
The date and time when the annotation was created.- Returns:
- a
PdfString
which value should be in the date format specified in (ISO-320001 7.9.4, "Dates").
-
setCreationDate
public PdfMarkupAnnotation setCreationDate(PdfString creationDate)
Sets the date and time when the annotation was created.- Parameters:
creationDate
-PdfString
which value should be in the date format specified in (ISO-320001 7.9.4, "Dates").- Returns:
- this
PdfMarkupAnnotation
instance.
-
getInReplyToObject
public PdfDictionary getInReplyToObject()
An annotation object that this annotation is "in reply to." Both annotations shall be on the same page of the document. The relationship between the two annotations shall be specified by the RT entry (seegetReplyType()
).- Returns:
- a
PdfDictionary
that represents an annotation that this annotation is "in reply to."
-
getInReplyTo
public PdfAnnotation getInReplyTo()
An annotation that this annotation is "in reply to." Both annotations shall be on the same page of the document. The relationship between the two annotations shall be specified by the RT entry (seegetReplyType()
).- Returns:
- a
PdfAnnotation
that this annotation is "in reply to."
-
setInReplyTo
public PdfMarkupAnnotation setInReplyTo(PdfAnnotation inReplyTo)
Sets an annotation that this annotation is "in reply to." Both annotations shall be on the same page of the document. The relationship between the two annotations shall be specified by the RT entry (seegetReplyType()
).- Parameters:
inReplyTo
- aPdfAnnotation
that this annotation is "in reply to."- Returns:
- this
PdfMarkupAnnotation
instance.
-
setPopup
public PdfMarkupAnnotation setPopup(PdfPopupAnnotation popup)
Sets a pop-up annotation for entering or editing the text associated with this annotation. Pop-up annotation defines an associated with this annotation pop-up window that may contain text. The Contents (seePdfAnnotation.setContents(PdfString)
) entry of the annotation that has an associated popup specifies the text that shall be displayed when the pop-up window is opened.- Parameters:
popup
- anPdfPopupAnnotation
that will be associated with this annotation.- Returns:
- this
PdfMarkupAnnotation
instance.
-
getPopupObject
public PdfDictionary getPopupObject()
An associated pop-up annotation object. SeegetPopup()
for more info.- Returns:
- a
PdfDictionary
that represents an associated pop-up annotation, or null if popup annotation is not specified.
-
getPopup
public PdfPopupAnnotation getPopup()
An associated pop-up annotation for entering or editing the text associated with this annotation. Pop-up annotation defines an associated with this annotation pop-up window that may contain text. The Contents (seePdfAnnotation.getContents()
) entry of the annotation that has an associated popup specifies the text that shall be displayed when the pop-up window is opened.- Returns:
- an
PdfPopupAnnotation
that is associated with this annotation, or null if there is none.
-
getSubject
public PdfString getSubject()
Text representing a short description of the subject being addressed by the annotation.- Returns:
- a
PdfString
which value is a annotation subject.
-
setSubject
public PdfMarkupAnnotation setSubject(PdfString subject)
Sets the text representing a short description of the subject being addressed by the annotation.- Parameters:
subject
- aPdfString
which value is a annotation subject.- Returns:
- this
PdfMarkupAnnotation
instance.
-
getReplyType
public PdfName getReplyType()
A name specifying the relationship (the "reply type") between this annotation and one specified by IRT entry (seegetInReplyTo()
). Valid values are:PdfName.R
- The annotation shall be considered a reply to the annotation specified by IRT. Conforming readers shall not display replies to an annotation individually but together in the form of threaded comments.PdfName.Group
- The annotation shall be grouped with the annotation specified by IRT.
-
setReplyType
public PdfMarkupAnnotation setReplyType(PdfName replyType)
Sets the relationship (the "reply type") between this annotation and one specified by IRT entry (seesetInReplyTo(PdfAnnotation)
). For valid values seegetInReplyTo()
.- Parameters:
replyType
- aPdfName
specifying relationship with the specified by the IRT entry.- Returns:
- this
PdfMarkupAnnotation
instance.
-
getIntent
public PdfName getIntent()
A name describing the intent of the markup annotation. SeesetIntent(PdfName)
for more info.- Returns:
- a
PdfName
describing the intent of the markup annotation, or null if not specified.
-
setIntent
public PdfMarkupAnnotation setIntent(PdfName intent)
Sets a name describing the intent of the markup annotation. Intents allow conforming readers to distinguish between different uses and behaviors of a single markup annotation type. If this entry is not present or its value is the same as the annotation type, the annotation shall have no explicit intent and should behave in a generic manner in a conforming reader.See ISO-320001, free text annotations (Table 174), line annotations (Table 175), polygon annotations (Table 178), and polyline annotations (Table 178) for the specific intent values for those types.
- Parameters:
intent
- aPdfName
describing the intent of the markup annotation.- Returns:
- this
PdfMarkupAnnotation
instance.
-
getExternalData
public PdfDictionary getExternalData()
An external data dictionary specifying data that shall be associated with the annotation. This dictionary contains the following entries:PdfName.Type
- (optional) If present, shall bePdfName.ExData
.PdfName.Subtype
- (required) a name specifying the type of data that the markup annotation shall be associated with. The only defined value isPdfName.Markup3D
. Table 298 (ISO-320001) lists the values that correspond to a subtype of Markup3D (See alsoPdf3DAnnotation
).
- Returns:
- An external data
PdfDictionary
, or null if not specified.
-
setExternalData
public PdfMarkupAnnotation setExternalData(PdfDictionary exData)
Sets an external data dictionary specifying data that shall be associated with the annotation. This dictionary should contain the following entries:PdfName.Type
- (optional) If present, shall bePdfName.ExData
.PdfName.Subtype
- (required) a name specifying the type of data that the markup annotation shall be associated with. The only defined value isPdfName.Markup3D
. Table 298 (ISO-320001) lists the values that correspond to a subtype of Markup3D (See alsoPdf3DAnnotation
).
- Parameters:
exData
- the external data dictionary- Returns:
- this
PdfMarkupAnnotation
instance
-
-