Stay organized with collections
Save and categorize content based on your preferences.
HighlightAnnotation
class HighlightAnnotation : PdfAnnotation
Represents a highlight annotation in a PDF document.
If the highlight color is not explicitly set using #setColor(android.graphics.Color), the default color is yellow.
Summary
Public constructors |
Creates a new highlight annotation with the specified bounds list.
|
Public methods |
MutableList<RectF!> |
Returns the bounding rectangles of the highlight annotation.
|
Int |
Returns the highlight color of the annotation.
|
Unit |
Sets the bounding rectangles of the highlight annotation.
|
Unit |
Sets the highlight color of the annotation.
|
Public constructors
HighlightAnnotation
HighlightAnnotation(boundsList: MutableList<RectF!>)
Creates a new highlight annotation with the specified bounds list.
The default highlight color is yellow
Parameters |
boundsList |
MutableList<RectF!>: The bounding rectangle of the annotation. This value cannot be null . |
Public methods
getBoundsList
fun getBoundsList(): MutableList<RectF!>
Returns the bounding rectangles of the highlight annotation.
getColor
fun getColor(): Int
Returns the highlight color of the annotation.
Return |
Int |
The highlight color. |
setBoundsList
fun setBoundsList(boundsList: MutableList<RectF!>): Unit
Sets the bounding rectangles of the highlight annotation. Each rect in the list mBoundsList represent an absolute position of highlight inside the page of the document
Parameters |
boundsList |
MutableList<RectF!>: The new bounding rectangles. This value cannot be null . |
Exceptions |
java.lang.IllegalArgumentException |
if the given bounds list is empty |
setColor
fun setColor(color: Int): Unit
Sets the highlight color of the annotation.
Parameters |
color |
Int: The new highlight color. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[],[],null,["# HighlightAnnotation\n\nAdded in [S Extensions 18](https://developer.android.com/sdkExtensions)\n\nHighlightAnnotation\n===================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/graphics/pdf/component/HighlightAnnotation \"View this page in Java\") \n\n```\nclass HighlightAnnotation : PdfAnnotation\n```\n\n|---|---|---------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||\n| ↳ | [android.graphics.pdf.component.PdfAnnotation](/reference/kotlin/android/graphics/pdf/component/PdfAnnotation) ||\n| | ↳ | [android.graphics.pdf.component.HighlightAnnotation](#) |\n\nRepresents a highlight annotation in a PDF document.\n\nIf the highlight color is not explicitly set using #setColor(android.graphics.Color), the default color is yellow.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [HighlightAnnotation](#HighlightAnnotation(kotlin.collections.MutableList))`(`boundsList:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[RectF](../../RectF.html#)!\u003e`)` Creates a new highlight annotation with the specified bounds list. |\n\n| Public methods ||\n|----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[RectF](../../RectF.html#)!\\\u003e | [getBoundsList](#getBoundsList())`()` Returns the bounding rectangles of the highlight annotation. |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getColor](#getColor())`()` Returns the highlight color of the annotation. |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setBoundsList](#setBoundsList(kotlin.collections.MutableList))`(`boundsList:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[RectF](../../RectF.html#)!\u003e`)` Sets the bounding rectangles of the highlight annotation. |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setColor](#setColor(kotlin.Int))`(`color:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the highlight color of the annotation. |\n\n| Inherited functions ||\n|---|---|\n| From class [PdfAnnotation](/reference/kotlin/android/graphics/pdf/component/PdfAnnotation) |----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getPdfAnnotationType](/reference/kotlin/android/graphics/pdf/component/PdfAnnotation#getPdfAnnotationType())`()` Returns the type of the annotation. \u003cbr /\u003e | ||\n\nPublic constructors\n-------------------\n\n### HighlightAnnotation\n\nAdded in [S Extensions 18](https://developer.android.com/sdkExtensions) \n\n```\nHighlightAnnotation(boundsList: MutableList\u003cRectF!\u003e)\n```\n\nCreates a new highlight annotation with the specified bounds list.\n\nThe default highlight color is yellow\n\n| Parameters ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `boundsList` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[RectF](../../RectF.html#)!\\\u003e: The bounding rectangle of the annotation. This value cannot be `null`. |\n\nPublic methods\n--------------\n\n### getBoundsList\n\nAdded in [S Extensions 18](https://developer.android.com/sdkExtensions) \n\n```\nfun getBoundsList(): MutableList\u003cRectF!\u003e\n```\n\nReturns the bounding rectangles of the highlight annotation.\n\n| Return ||\n|--------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|\n| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[RectF](../../RectF.html#)!\u003e | The bounding rectangles. This value cannot be `null`. |\n\n### getColor\n\nAdded in [S Extensions 18](https://developer.android.com/sdkExtensions) \n\n```\nfun getColor(): Int\n```\n\nReturns the highlight color of the annotation.\n\n| Return ||\n|----------------------------------------------------------------------------|----------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The highlight color. |\n\n### setBoundsList\n\nAdded in [S Extensions 18](https://developer.android.com/sdkExtensions) \n\n```\nfun setBoundsList(boundsList: MutableList\u003cRectF!\u003e): Unit\n```\n\nSets the bounding rectangles of the highlight annotation. Each rect in the list mBoundsList represent an absolute position of highlight inside the page of the document\n\n| Parameters ||\n|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `boundsList` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[RectF](../../RectF.html#)!\\\u003e: The new bounding rectangles. This value cannot be `null`. |\n\n| Exceptions ||\n|--------------------------------------|-----------------------------------|\n| `java.lang.IllegalArgumentException` | if the given bounds list is empty |\n\n### setColor\n\nAdded in [S Extensions 18](https://developer.android.com/sdkExtensions) \n\n```\nfun setColor(color: Int): Unit\n```\n\nSets the highlight color of the annotation.\n\n| Parameters ||\n|---------|------------------------------------------------------------------------------------------------------|\n| `color` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new highlight color. |"]]