TextFieldAnnotation class
TextFieldAnnotation class
Represents text field annotation properties.
Learn more
- More about annotation types and annotating PDF and Microsoft Word documents, Excel spreadsheets and PowerPoint Presentations: How to annotate documents using GroupDocs.Annotation for .NET
- More about adding text field annotations to documents of various types: How to add text field annotations in C#
The TextFieldAnnotation type exposes the following members:
Constructors
| Constructor | Description |
|---|---|
| init | Initializes a new TextFieldAnnotation instance. |
Methods
| Method | Description |
|---|---|
| clone | Returns a new instance with the same values. |
| equals | Compares this text field annotation with another using the IEquatable Equals method. |
| equals | Compares text field annotation using standard object Equals method. |
| equals_object | |
| equals_text_field_annotation | |
| get_hash_code | Returns HashCode of the text field annotation. |
| equals_annotation_base | (inherited from AnnotationBase) |
Properties
| Property | Description |
|---|---|
| background_color | The background color of the text field annotation. |
| box | The text field annotation position. |
| font_color | The font color of the text field annotation. |
| font_family | The font family of the text field annotation. |
| font_size | The font size of the text field annotation. |
| opacity | The opacity of the text field annotation. |
| pen_color | The pen color of the text field annotation. |
| pen_style | The pen style of the text field annotation. |
| pen_width | The pen width of the text field annotation. |
| text | The text of the text field annotation. |
| text_horizontal_alignment | The horizontal alignment of the 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 Rectangle, HorizontalAlignment
from groupdocs.annotation.models.annotation_models import TextFieldAnnotation
from groupdocs.pydrawing import Color
def add_text_field_annotation():
with Annotator("./sample.pdf") as annotator:
text_field = TextFieldAnnotation()
text_field.box = Rectangle(100, 100, 150, 50)
text_field.text = "Some text in a field"
text_field.font_family = "Arial"
text_field.font_size = 12.0
text_field.font_color = Color.black.to_argb()
text_field.background_color = Color.yellow.to_argb()
text_field.text_horizontal_alignment = HorizontalAlignment.CENTER
text_field.opacity = 0.9
text_field.page_number = 0
text_field.message = "This is a text field annotation"
annotator.add(text_field)
annotator.save("./output.pdf")
if __name__ == "__main__":
add_text_field_annotation()
Guides
Task guides that use TextFieldAnnotation: