PdfAnnotation

data class PdfAnnotation(val subtype: PdfAnnotation.Subtype, val rect: Rectangle, 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 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: Rectangle, 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, 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

/AP /N appearance Form XObject, or null.

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

/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.