HighlightAnnotation class
HighlightAnnotation class
Represents highlight annotation properties.
Learn more
- More about annotation types and annotating PDF and Microsoft Word documents, Excel spreadsheets and PowerPoint Presentations: https://docs.groupdocs.com/display/annotationnet/Add+annotation+to+the+document
- More about adding highlight annotations to documents of various types: https://docs.groupdocs.com/display/annotationnet/Add+highlight+annotation
The HighlightAnnotation type exposes the following members:
Constructors
| Constructor | Description |
|---|---|
| init | Initializes a new instance of HighlightAnnotation. |
Methods
| Method | Description |
|---|---|
| clone | Returns a new instance with the same values. |
| equals | Compares highlight annotation using IEquatable Equals method. |
| equals | Compares highlight annotations using the standard object Equals method. |
| equals_highlight_annotation | |
| equals_object | |
| get_hash_code | Returns the hash code of the highlight annotation. |
| equals_annotation_base | (inherited from AnnotationBase) |
Properties
| Property | Description |
|---|---|
| background_color | The background color of the highlight annotation as an ARGB integer. |
| font_color | The highlight annotation text font color. |
| opacity | The opacity of the highlight annotation. |
| points | The collection of Point objects that describe rectangles with text. |
| created_on | The annotation creation date. (inherited from AnnotationBase) |
| id | The annotation unique identifier. This field is auto-incremented. (inherited from AnnotationBase) |
| message | The annotation message. (inherited from AnnotationBase) |
| page_number | The page number where the annotation should be located. (inherited from AnnotationBase) |
| replies | The list of replies (comments) attached to the annotation. (inherited from AnnotationBase) |
| state_before_annotation | The previous state of the text before annotating. (inherited from AnnotationBase) |
| type | The annotation type. (inherited from AnnotationBase) |
| user | The annotation author. (inherited from AnnotationBase) |
Example
from groupdocs.annotation import Annotator
from groupdocs.annotation.models import Point
from groupdocs.annotation.models.annotation_models import HighlightAnnotation
from groupdocs.pydrawing import Color
def add_highlight_annotation():
with Annotator("./sample.pdf") as annotator:
highlight = HighlightAnnotation()
# Text-markup annotations are positioned by the corner points of the
# text region: top-left, top-right, bottom-left, bottom-right
highlight.points = [
Point(80, 600), Point(300, 600),
Point(80, 575), Point(300, 575),
]
highlight.background_color = Color.yellow.to_argb()
highlight.opacity = 0.7
highlight.page_number = 0
highlight.message = "This is a highlight annotation"
annotator.add(highlight)
annotator.save("./output.pdf")
Guides
Task guides that use HighlightAnnotation: