__init__ constructor

init

Initializes annotator class which accepts a document path.

def __init__(self, file_path):
    ...
Parameter Type Description
file_path str File path.

Example

from groupdocs.annotation import Annotator

with Annotator("./annotated.pdf") as annotator:
    # Export annotations to an XML file
    annotator.export_annotations_to_xml_file(output_path="./exported_annotations.xml")

init

Initializes annotator class which accepts document path and options.

Learn more

def __init__(self, file_path, load_options):
    ...
Parameter Type Description
file_path str File path.
load_options LoadOptions Load options.

Example

from groupdocs.annotation import Annotator

def export_annotations_to_xml():
    with Annotator("./annotated.pdf") as annotator:
        annotator.export_annotations_to_xml_file(output_path="./exported_annotations.xml")
    print("Exported annotations to ./exported_annotations.xml.")

init

Initializes annotator class which accepts document path and settings.

def __init__(self, file_path, settings):
    ...
Parameter Type Description
file_path str File path.
settings AnnotatorSettings Annotator settings.

Example

from groupdocs.annotation import Annotator

with Annotator("./sample.pdf") as annotator:
    # perform annotation operations here
    annotator.save("./output.pdf")

init

Initializes annotator class which accept document path, options and settings.

Learn more:

def __init__(self, file_path, load_options, settings):
    ...
Parameter Type Description
file_path str File path.
load_options LoadOptions Load options.
settings AnnotatorSettings Annotator settings.

Example

from groupdocs.annotation import Annotator

def export_annotations_to_xml():
    with Annotator("./annotated.pdf") as annotator:
        annotator.export_annotations_to_xml_file(output_path="./exported_annotations.xml")
    print("Exported annotations to ./exported_annotations.xml.")

init

Initializes annotator class which accepts a document stream.

Learn more

def __init__(self, document):
    ...
Parameter Type Description
document io.RawIOBase Document stream.

Example

import io
from groupdocs.annotation import Annotator

with Annotator("document.pdf") as annotator:
    # add annotations here, e.g., annotator.add(area)
    buf = io.BytesIO()
    annotator.save(buf)  # BytesIO is updated after save
    data = buf.getvalue()

init

Initializes annotator class which accepts a document stream and options.

def __init__(self, document, load_options):
    ...
Parameter Type Description
document io.RawIOBase Document stream.
load_options LoadOptions Load options. - More about file types supported by GroupDocs.Annotation: https://docs.groupdocs.com/display/annotationnet/Supported+Document+Formats - More about GroupDocs.Annotation for .NET features: https://docs.groupdocs.com/display/annotationnet/Developer+Guide - More about how to open and annotate password-protected document: https://docs.groupdocs.com/display/annotationnet/Load+password-protected+documents - More about how to open and annotate document from URL, FTP, Amazon S3, Azure Blob Storage and others: https://docs.groupdocs.com/display/annotationnet/Loading+documents+from+different+sources

Example

from groupdocs.annotation import Annotator

def export_annotations_to_xml():
    with Annotator("./annotated.pdf") as annotator:
        annotator.export_annotations_to_xml_file(output_path="./exported_annotations.xml")
    print("Exported annotations to ./exported_annotations.xml.")

init

Initializes annotator class which accepts a document stream and settings.

def __init__(self, document, settings):
    ...
Parameter Type Description
document io.RawIOBase Document stream.
settings AnnotatorSettings Annotator settings.

Example

from groupdocs.annotation import Annotator

def export_annotations_to_xml():
    with Annotator("./annotated.pdf") as annotator:
        annotator.export_annotations_to_xml_file(output_path="./exported_annotations.xml")
    print("Exported annotations to ./exported_annotations.xml.")

init

Initializes annotator class which accepts a document stream, load options, and settings.

Learn more.

def __init__(self, document, load_options, settings):
    ...
Parameter Type Description
document io.RawIOBase Document stream.
load_options LoadOptions Load options.
settings AnnotatorSettings Annotator settings.

See Also