PdfAnnotation

data class PdfAnnotation(val subtype: PdfAnnotation.Subtype, val rect: KiteRectangle, val contents: String, val color: RgbColor?, val uri: String?, val action: PdfAction?, val rawDestination: PdfObject?, val appearanceStream: PdfStream?, val flags: Int = 0, val quadPoints: List<Double>? = null, val inkLists: List<List<Double>>? = null, val vertices: List<Double>? = null, val interiorColor: RgbColor? = null, val borderWidth: Double? = null, val borderStyle: String? = null, val borderDash: List<Double>? = null, val additionalActions: PdfWidgetActions? = null, val raw: PdfDictionary)

One PDF annotation (ISO 32000-1 §12.5).

The subtype discriminates between the 20+ annotation types defined in the spec. First-class support is provided for:

Other subtypes are parsed into Subtype.Other and exposed in raw so callers can pattern-match. The rectangle and contents are always there.

For rendering, appearanceStream (the /AP /N stream when present) is the canonical way to draw the annotation. It is a Form XObject the spec mandates "shall be used as the visual representation." We expose it as a raw stream so PageRenderer can recursively render it.

Constructors

Link copied to clipboard
constructor(subtype: PdfAnnotation.Subtype, rect: KiteRectangle, contents: String, color: RgbColor?, uri: String?, action: PdfAction?, rawDestination: PdfObject?, appearanceStream: PdfStream?, flags: Int = 0, quadPoints: List<Double>? = null, inkLists: List<List<Double>>? = null, vertices: List<Double>? = null, interiorColor: RgbColor? = null, borderWidth: Double? = null, borderStyle: String? = null, borderDash: List<Double>? = null, additionalActions: PdfWidgetActions? = null, raw: PdfDictionary)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Properties

Link copied to clipboard

Parsed /A action (typed). null when the annotation has no action dict.

Link copied to clipboard

The scripts in the annotation's /AA dictionary: the mouse and focus triggers of any annotation, and on a form widget the keystroke, format, validate and calculate triggers (§12.6.3, Table 194 and Table 196). Null when the annotation has no /AA.

Link copied to clipboard

/AP /N appearance Form XObject, or null.

Link copied to clipboard

Dash array from /BS /D, or the one /Border may carry as its fourth element.

Link copied to clipboard

Border style from /BS /S: S solid, D dashed, B beveled, I inset, U underline. Null when undeclared.

Link copied to clipboard

Declared border width in points, from /BS /W or the third element of /Border, or null when the annotation declares neither and the §12.5.4 default of 1 applies.

Link copied to clipboard

Border / highlight / underline colour, or null when /C is omitted.

Link copied to clipboard
Link copied to clipboard
val flags: Int

Annotation flags (/F): bit 2 = Hidden, bit 6 = NoView, etc. (§12.5.3).

Link copied to clipboard

/InkList: one list of alternating x/y per ink stroke.

Link copied to clipboard

/IC interior (fill) colour for Square/Circle/Line/Polygon.

Link copied to clipboard

True when the annotation should not be displayed (Hidden or NoView set).

Link copied to clipboard

The Invisible flag (§12.5.3, Table 165, bit 1): a viewer with no handler for a non-standard subtype hides the annotation instead of drawing its appearance.

Link copied to clipboard

The NoZoom flag (§12.5.3, Table 165, bit 4): the appearance keeps its own size, with the upper-left corner of the rectangle fixed, instead of stretching to the rectangle.

Link copied to clipboard

/QuadPoints (8 numbers per quad) for text-markup annotations.

Link copied to clipboard

The raw dict, for callers that need fields we didn't extract.

Link copied to clipboard

Raw /Dest value on link annotations. Pass through PdfDocument.resolveDestination.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val uri: String?

Link annotation: URL for /A /URI actions; null otherwise.

Link copied to clipboard

/Vertices (Polygon/PolyLine) or /L (Line): alternating x/y.