add method

Contents
[ ]

add

Adds annotation to document.

Learn more

def add(self, annotation):
    ...
Parameter Type Description
annotation AnnotationBase The annotation to add.

Returns: None.

Example

from groupdocs.annotation import Annotator
from groupdocs.annotation.models import Rectangle
from groupdocs.annotation.models.annotation_models import PointAnnotation

with Annotator("./sample.pdf") as annotator:
    point = PointAnnotation()
    point.box = Rectangle(100, 100, 0, 0)
    point.page_number = 0
    point.message = "This is a point annotation"
    annotator.add(point)
    annotator.save("./output.pdf")

add

Adds a collection of annotations to a document.

Learn more

def add(self, annotations):
    ...
Parameter Type Description
annotations List[AnnotationBase] The annotations list to add.

Returns: None.

Example

from groupdocs.annotation import Annotator
from groupdocs.annotation.models import Rectangle
from groupdocs.annotation.models.annotation_models import PointAnnotation

def add_point_annotation():
    with Annotator("./sample.pdf") as annotator:
        point = PointAnnotation()
        point.box = Rectangle(100, 100, 0, 0)   # a point is positioned by its box origin
        point.page_number = 0
        point.message = "This is a point annotation"
        annotator.add([point])
        annotator.save("./output.pdf")

See Also