Skip to main content

BaseAnnotation Class

Serves as the base class for PDF annotations.

Declaration

public abstract class BaseAnnotation extends JavaObject implements ICloneable

Remarks

The BaseAnnotation class defines common annotation settings, such as bounds, content, color, appearance, modification date, and annotation settings.

Refer to the following help topic for additional information: PDF Document Annotations.

Implements

com.devexpress.system.ICloneable

Inherited Members

com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.initFields()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
com.devexpress.system.JavaObject
BaseAnnotation

Methods

clone(DocumentCloneContext context) Method

Creates a copy of the annotation in the specified document clone context.

Declaration

public BaseAnnotation clone(DocumentCloneContext context)

Parameters

Name Type Description
context DocumentCloneContext

A context that stores objects and resources used during document cloning.

Returns

Type Description
BaseAnnotation

A cloned annotation instance.

Remarks

Use this method to copy annotations together with document content.

deepClone() Method

Creates a deep copy of the annotation.

Declaration

public BaseAnnotation deepClone()

Returns

Type Description
BaseAnnotation

A new annotation instance with copied annotation data.

Remarks

Use a deep clone to create an independent annotation copy before adding it to a page or modifying common annotation properties.

getAppearance() Method

Returns annotation appearances.

Declaration

public AnnotationAppearances getAppearance()

Returns

Type Description
AnnotationAppearances

An object that defines annotation appearance states.

Remarks

Annotation appearances define how an annotation is rendered in normal, rollover, or down states.

getAppearanceName() Method

Returns the active annotation appearance name.

Declaration

public String getAppearanceName()

Returns

Type Description
String

The name of the active appearance state.

Remarks

The appearance name identifies which appearance state is currently used to render the annotation.

getBorder() Method

Returns annotation border settings.

Declaration

public AnnotationBorder getBorder()

Returns

Type Description
AnnotationBorder

Annotation border settings.

Remarks

Border settings affect the visible outline of annotations that support a border, such as text, link, drawing, and markup annotations.

getBounds() Method

Returns annotation bounds.

Declaration

public RectangleF getBounds()

Returns

Type Description
RectangleF

Annotation bounds on the page.

Remarks

Bounds define the annotation rectangle in page coordinates. Use bounds to position annotations such as text notes, links, stamps, watermarks, and drawing marks.

getColor() Method

Returns the annotation color.

Declaration

public PdfColor getColor()

Returns

Type Description
PdfColor

The annotation color.

Remarks

Color affects the visual appearance of annotations that expose a common color setting, such as markup, text, stamp, and drawing annotations.

getContent() Method

Returns the annotation content.

Declaration

public String getContent()

Returns

Type Description
String

The annotation content text.

Remarks

Content stores the annotation text, comment, or descriptive note that users can inspect when they review annotations.

getHidden() Method

Returns whether the annotation is hidden.

Declaration

public boolean getHidden()

Returns

Type Description
boolean

true if the annotation is hidden; otherwise, false.

Remarks

A hidden annotation is not displayed, printed, or available for user interaction.

getInvisible() Method

Returns whether the annotation is invisible.

Declaration

public boolean getInvisible()

Returns

Type Description
boolean

true if the annotation is invisible; otherwise, false.

Remarks

The invisible setting specifies whether an annotation is displayed when the viewer cannot recognize the annotation type.

getLocked() Method

Returns whether the annotation is locked.

Declaration

public boolean getLocked()

Returns

Type Description
boolean

true if the annotation is locked; otherwise, false.

Remarks

A locked annotation cannot be deleted.

getLockedContents() Method

Returns whether the annotation contents are locked.

Declaration

public boolean getLockedContents()

Returns

Type Description
boolean

true if the annotation contents are locked; otherwise, false.

Remarks

Locked contents prevent users from changing the annotation text or other content while preserving the annotation object.

getModified() Method

Returns the annotation modification date.

Declaration

public OffsetDateTime getModified()

Returns

Type Description
OffsetDateTime

The annotation modification date and time.

Remarks

The modification date indicates when annotation data or appearance was last changed.

getName() Method

Returns the annotation name.

Declaration

public String getName()

Returns

Type Description
String

The annotation name.

Remarks

The annotation name identifies an annotation within a document and can help when you find or update annotations programmatically.

getNoRotate() Method

Returns whether the annotation ignores page rotation.

Declaration

public boolean getNoRotate()

Returns

Type Description
boolean

true if the annotation does not rotate with the page; otherwise, false.

Remarks

Use this setting for annotations that should keep their orientation when a page is rotated.

getNoView() Method

Returns whether the annotation is displayed on screen.

Declaration

public boolean getNoView()

Returns

Type Description
boolean

true if the annotation is not displayed on screen; otherwise, false.

Remarks

The NoView setting hides the annotation in the document viewer but allows it to be printed if the Print setting is enabled.

getNoZoom() Method

Returns whether the annotation scales with page zoom.

Declaration

public boolean getNoZoom()

Returns

Type Description
boolean

true if the annotation does not scale with page zoom; otherwise, false.

Remarks

Use this setting for annotations that should keep the same visual size regardless of the page zoom level.

getPrint() Method

Returns whether the annotation is included in printed output.

Declaration

public boolean getPrint()

Returns

Type Description
boolean

true if the annotation is included in printed output; otherwise, false.

Remarks

The print setting specifies whether the annotation is included in printed output, even if it is hidden in the on-screen view.

getReadOnly() Method

Returns whether the annotation is read-only.

Declaration

public boolean getReadOnly()

Returns

Type Description
boolean

true if the annotation is read-only; otherwise, false.

Remarks

A read-only annotation cannot be changed through user interaction in a PDF viewer.

getToggleNoView() Method

Returns whether the annotation visibility changes when the no-view setting state changes.

Declaration

public boolean getToggleNoView()

Returns

Type Description
boolean

true if annotation visibility changes based on the no-view setting state; otherwise, false.

Remarks

The ToggleNoView setting allows viewer events to invert the annotation’s visibility when the event state changes.

objectClone() Method

Creates an object copy of the annotation.

Declaration

public Object objectClone()

Returns

Type Description
Object

A cloned annotation object.

setAppearance(AnnotationAppearances value) Method

Sets annotation appearances.

Declaration

public void setAppearance(AnnotationAppearances value)

Parameters

Name Type Description
value AnnotationAppearances

An object that defines annotation appearance states.

setAppearanceName(String value) Method

Sets the active annotation appearance name.

Declaration

public void setAppearanceName(String value)

Parameters

Name Type Description
value String

The appearance state name.

Remarks

Use this method to specify a specific appearance state from the annotation appearance collection. Call the getAppearance() method to access the appearance collection.

setBorder(AnnotationBorder value) Method

Sets annotation border settings.

Declaration

public void setBorder(AnnotationBorder value)

Parameters

Name Type Description
value AnnotationBorder

Annotation border settings.

Remarks

Set border options to customize the visual outline of annotations that display a boundary or clickable region.

setBounds(RectangleF value) Method

Sets annotation bounds.

Declaration

public void setBounds(RectangleF value)

Parameters

Name Type Description
value RectangleF

Annotation bounds on the page.

setColor(PdfColor value) Method

Sets the annotation color.

Declaration

public void setColor(PdfColor value)

Parameters

Name Type Description
value PdfColor

The annotation color.

Remarks

Set the annotation color to emphasize review notes, highlights, drawing marks, or other visible annotation elements.

setContent(String value) Method

Sets the annotation content.

Declaration

public void setContent(String value)

Parameters

Name Type Description
value String

The annotation content text.

setHidden(boolean value) Method

Sets whether the annotation is hidden.

Declaration

public void setHidden(boolean value)

Parameters

Name Type Description
value boolean

true to hide the annotation; otherwise, false.

Remarks

Use this setting to suppress annotation display, printing, and interaction when the annotation should remain in the document but not be visible to users.

setInvisible(boolean value) Method

Sets whether the annotation is invisible.

Declaration

public void setInvisible(boolean value)

Parameters

Name Type Description
value boolean

true to make the annotation invisible; otherwise, false.

Remarks

Set this setting when an annotation should not be displayed by viewers that do not recognize its annotation type.

setLocked(boolean value) Method

Sets whether the annotation is locked.

Declaration

public void setLocked(boolean value)

Parameters

Name Type Description
value boolean

true to lock the annotation; otherwise, false.

Remarks

Lock annotations to prevent users from deleting them or changing their common annotation properties in a PDF viewer.

setLockedContents(boolean value) Method

Sets whether the annotation contents are locked.

Declaration

public void setLockedContents(boolean value)

Parameters

Name Type Description
value boolean

true to lock the annotation contents; otherwise, false.

Remarks

Use this setting to protect annotation comments or other content from user edits without locking all annotation properties.

setModified(OffsetDateTime value) Method

Sets the annotation modification date.

Declaration

public void setModified(OffsetDateTime value)

Parameters

Name Type Description
value OffsetDateTime

The annotation modification date and time.

Remarks

Update the modification date when you change annotation content, position, appearance, or review metadata.

setName(String value) Method

Sets the annotation name.

Declaration

public void setName(String value)

Parameters

Name Type Description
value String

The annotation name.

Remarks

Set a name when you need to identify, find, or update a specific annotation in a PDF document.

setNoRotate(boolean value) Method

Sets whether the annotation ignores page rotation.

Declaration

public void setNoRotate(boolean value)

Parameters

Name Type Description
value boolean

true if the annotation should not rotate with the page; otherwise, false.

Remarks

Set this setting to keep annotation orientation fixed when users rotate the PDF page view.

setNoView(boolean value) Method

Sets whether the annotation is displayed on screen.

Declaration

public void setNoView(boolean value)

Parameters

Name Type Description
value boolean

true to hide the annotation on screen; otherwise, false.

Remarks

Use this setting for annotations that should not appear in the document view but should remain available for printing or programmatic processing.

setNoZoom(boolean value) Method

Sets whether the annotation scales with page zoom.

Declaration

public void setNoZoom(boolean value)

Parameters

Name Type Description
value boolean

true if the annotation should not scale with page zoom; otherwise, false.

Remarks

Use this setting to keep the annotation the same visual size regardless of the page zoom level.

setPrint(boolean value) Method

Sets whether the annotation is included in printed output.

Declaration

public void setPrint(boolean value)

Parameters

Name Type Description
value boolean

true to include the annotation in printed output; otherwise, false.

setReadOnly(boolean value) Method

Sets whether the annotation is read-only.

Declaration

public void setReadOnly(boolean value)

Parameters

Name Type Description
value boolean

true to make the annotation read-only; otherwise, false.

Remarks

Use this setting when users should be able to view an annotation but should not modify it interactively.

setToggleNoView(boolean value) Method

Sets whether the annotation visibility changes when the no-view setting state changes.

Declaration

public void setToggleNoView(boolean value)

Parameters

Name Type Description
value boolean

true to change annotation visibility based on the no-view setting state; otherwise, false.

Remarks

Use this setting when annotation visibility should change in response to viewer events.