Types

Link copied to clipboard
object Companion

Companion object containing constants and utility methods for Annotation.

Properties

Link copied to clipboard
@get:FloatRange(from = 0.0, to = 1.0)
var alpha: Float

Returns the annotation's main alpha (or stroke alpha). For annotations that also have a fill colour, such as shapes, this is the border/line alpha.

Link copied to clipboard

Returns custom appearance stream generator that overrides appearance stream generation of this annotation.

Link copied to clipboard

Returns currently set blend mode. Defaults to BlendMode.NORMAL for all annotations except highlight.

Link copied to clipboard
open var borderColor: Int

Returns the border color of this annotation or Color.TRANSPARENT if no color is set. Note that alpha channel is not taken into account as per PDF specifications.

Link copied to clipboard

Returns currently set dash array or null if no pattern is set.

Link copied to clipboard

Returns the current border effect on the annotation or BorderEffect.NO_EFFECT if none is set.

Link copied to clipboard

Returns the current border effect intensity. Valid only if the border effect is BorderEffect.CLOUDY. The value is suggested to be between 0 and 2 but other values are valid as well. Default value is 0.

Link copied to clipboard

Returns the current border style on the annotation or BorderStyle.NONE if none is set.

Link copied to clipboard

Returns the border line width / thickness. For border to appear, color and style should be set via borderColor and borderStyle as well.

Link copied to clipboard
open var boundingBox: RectF

Position of this annotation on the page. The returned RectF is a copy, so changing its values won't update the annotation's bounds. Instead call boundingBox providing the altered rect to update the annotation.

Link copied to clipboard
var color: Int

Returns a color associated with this annotation or Color.TRANSPARENT if no color is set. Note that alpha channel is not taken into account as per PDF specifications. This is the text color for FreeTextAnnotation and WidgetAnnotation. This is the stroke color for shapes.

Link copied to clipboard
open var contents: String?

Returns text contents of the annotation. This is usually the displayed text for annotations that display text or accessibility label for annotations that don't.

Link copied to clipboard

Returns the creation date of the annotation.

Link copied to clipboard

Returns the name of the creator of this annotation.

Link copied to clipboard

Sets custom data to the annotation. The contents of this property are saved to the document when saving.

Link copied to clipboard
@get:FloatRange(from = 0.0, to = 1.0)
var fillAlpha: Float

Returns the fill alpha.

Link copied to clipboard
open var fillColor: Int

Returns a fill color associated with this object or Color.TRANSPARENT if no color is set. Note that alpha channel is not taken into account as per PDF specifications.

Link copied to clipboard
open var flags: EnumSet<ERROR CLASS: Symbol not found for AnnotationFlags>

Annotation flags set. Changing returned EnumSet does not change annotation flags. Instead call flags to change annotation flags.

Link copied to clipboard

Gets/sets the font name for this annotation.

Link copied to clipboard

Returns the group string of the annotation. May be used to have multiple annotations that behave as single one, if their group string is equal. Only works within one page. This is a proprietary extension

Link copied to clipboard

Check if the annotation has locked contents - i.e. annotation content can't be modified.

Link copied to clipboard

Gets instant record group of the annotation, or null if this annotation is detached.

Link copied to clipboard

Tells whether this annotation is attached to a document.

Link copied to clipboard
open val isLocked: Boolean

Check if the annotation is locked - i.e. annotation can't be deleted or modified (except contents).

Link copied to clipboard

Returns true when the annotation is a measurement annotation. Measurement annotations can be:

Link copied to clipboard

Returns whether the annotation is modified or not.

Link copied to clipboard

Whether the annotations is a reply to another annotation.

Link copied to clipboard

Check if the annotation is resizable, or if this is a non-resizable annotation.

Link copied to clipboard

Returns true when the annotation is a signature annotation. Annotations that can be signatures are InkAnnotation and StampAnnotation.

Link copied to clipboard

Returns true if this Annotation can be rotated in the UI.

Link copied to clipboard

Returns MeasurementInfo when the annotation is a measurement annotation (see isMeasurement), null if not.

Link copied to clipboard
open val minimumSize: ERROR CLASS: Symbol not found for Size

Returns the minimum size of the annotation.

Link copied to clipboard

Returns the date when this annotation was last modified.

Link copied to clipboard
var name: String?

Returns the content of Title/Name field of this annotation. This can be used to globally identify the annotation. This property will be automatically set to a type 4 (pseudo random) UUID during annotation construction time.

Link copied to clipboard

The object number of this annotation inside the PDF document file. This method will only return a valid object number if this annotation is attached to a document (i.e. when isAttached returns true). If the annotation is not attached to any document, this method will return Annotation.OBJECT_NUMBER_NOT_SET.

Link copied to clipboard

The page number to which this annotation belongs. If the annotation is not attached to any document, this method will return Annotation.PAGE_NUMBER_NOT_SET.

Link copied to clipboard

Returns rich text contents of the annotation. This is text to be displayed in a pop-up for text markup annotations.

Link copied to clipboard

Returns the subject of this annotation.

Link copied to clipboard

Returns/sets the text justification used by this free text annotation.

Link copied to clipboard

Returns/sets the text size for this annotation (in PDF points).

Link copied to clipboard
abstract val type: ERROR CLASS: Symbol not found for AnnotationType

Gets the annotation type of the annotation.

Link copied to clipboard

A unique in-memory identifier for each annotation. Generated at runtime, therefore not persisted (in the PDF).

Link copied to clipboard

Returns/sets the vertical text alignment used by this free text annotation.

Functions

Link copied to clipboard
fun attachBinaryInstantJsonAttachment(dataProvider: ERROR CLASS: Symbol not found for DataProvider, mimeType: String?)

Attaches a binary instant JSON attachment to the annotation. Can later be fetched using fetchBinaryInstantJsonAttachment.

Link copied to clipboard
fun Annotation.createTextBlock(document: PdfDocument, range: ERROR CLASS: Symbol not found for Range): ERROR CLASS: Symbol not found for TextBlock

Creates TextBlock from textual annotation.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compares this annotation with another object for equality. Two annotations are considered equal if they have the same UUID.

Link copied to clipboard

If this annotation has a binary instant JSON attachment, this will write it into the provided OutputStream.

Link copied to clipboard

Regenerates the annotation's appearance stream if necessary.

Link copied to clipboard

Regenerates the annotation's appearance stream if necessary.

Link copied to clipboard

Position of this annotation on the page. Changing bounding box does not change annotations bounds. Instead call boundingBox to change annotation bounds.

Link copied to clipboard
fun getCopy(@IntRange(from = 0) pageIndex: Int): Annotation?

Creates a copy of this annotation that isn't attached to the document with the page index set to given index. If this type of annotation can't be copied this method will return null.

Link copied to clipboard

Retrieves the annotation this annotation replies to, or null it this annotation is not a reply or the license doesn't support replies feature.

Link copied to clipboard

Retrieves the annotation this annotation replies to asynchronously. The response is emitted inside the RxJava's Maybe. It will contain the requested annotation if it exists, or be empty otherwise.

Link copied to clipboard

Checks if this annotation has a binary instant JSON attachment. For example, a stamp annotation with an image has one.

Link copied to clipboard
fun hasFlag(flag: ERROR CLASS: Symbol not found for AnnotationFlags): Boolean

Test annotation flag.

Link copied to clipboard
open override fun hashCode(): Int

Returns a hash code value for this annotation based on its UUID.

Link copied to clipboard

Checks if this annotation has the same properties as another annotation, excluding identity properties like UUID, modified date, and name. This is useful for comparing annotations based on their visual and semantic content rather than their identity.

Link copied to clipboard
fun renderToBitmap(bitmap: Bitmap)

Renders the appearance of this annotation into the passed bitmap.

Link copied to clipboard
fun renderToBitmapAsync(bitmap: Bitmap): Single<Bitmap>
fun renderToBitmapAsync(bitmap: Bitmap, configuration: AnnotationRenderConfiguration): Single<Bitmap>

Asynchronously renders the appearance of this annotation into the passed bitmap.

Link copied to clipboard
fun setInReplyTo(parentAnnotation: Annotation?)

Sets the annotation that this annotation replies to.

Link copied to clipboard
open fun toInstantJson(): String

Produces Instant JSON representation of this annotation.

Link copied to clipboard
open override fun toString(): String

Returns a string representation of this annotation including its type and properties.

Link copied to clipboard
abstract fun updateTransformationProperties(newBoundingBox: RectF, oldBoundingBox: RectF)

Annotations may override this method to transform their properties (i.e. points, rects, sizes) whenever the bounding box of the annotation changed.