ImageAnnotation class
ImageAnnotation class
Represents image 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 image annotations to documents of various types: https://docs.groupdocs.com/display/annotationnet/Add+image+annotation
The ImageAnnotation type exposes the following members:
Constructors
| Constructor | Description |
|---|---|
| init | Initializes a new ImageAnnotation instance. |
Methods
| Method | Description |
|---|---|
| clone | Returns a new instance with the same values. |
| equals | Compares image annotation using IEquatable Equals method. |
| equals | Compares image annotation using standard object Equals method. |
| equals_image_annotation | |
| equals_object | |
| get_hash_code | Returns the hash code of the image annotation. |
| get_image | Gets image object. |
| equals_annotation_base | (inherited from AnnotationBase) |
Properties
| Property | Description |
|---|---|
| angle | The image annotation rotation angle. |
| box | The image annotation position. |
| image_data | The image annotation data. |
| image_extension | The image extensions (png, jpg, svg etc). |
| image_path | The image annotation path. |
| opacity | The opacity of the image annotation. |
| zindex | The image annotation z-index. Default value is 0. |
| 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 Rectangle
from groupdocs.annotation.models.annotation_models import ImageAnnotation
def add_image_annotation():
with Annotator("./sample.pdf") as annotator:
image = ImageAnnotation()
image.box = Rectangle(100, 100, 100, 100)
image.image_path = "./stamp.png"
image.opacity = 0.9
image.angle = 0.0
image.page_number = 0
image.message = "This is an image annotation"
annotator.add(image)
annotator.save("./output.pdf")
if __name__ == "__main__":
add_image_annotation()
Guides
Task guides that use ImageAnnotation: