importiofromgroupdocs.annotationimportAnnotatorfromgroupdocs.annotation.optionsimportSaveOptions,AnnotationTypewithAnnotator("document.pdf")asannotator:# add annotations here, e.g., annotator.add(area)# Save to a memory streamstream=io.BytesIO()annotator.save(stream)data=stream.getvalue()# Save with specific optionsoptions=SaveOptions()options.annotation_types=AnnotationType.AREAannotator.save("filtered.pdf",save_options=options)
save
Saves document after adding, updating or removing annotations.
importiofromgroupdocs.annotationimportAnnotatorwithAnnotator("document.pdf")asannotator:# add annotations as needed, e.g., annotator.add(area)buf=io.BytesIO()annotator.save(buf)# BytesIO is updated after savedata=buf.getvalue()
save
Saves the document after adding, updating, or removing annotations.
The output stream or file path where the annotated document will be saved.
save_options
SaveOptions
The save options that control which pages or annotation types are saved.
Example
importiofromgroupdocs.annotationimportAnnotatorfromgroupdocs.annotation.optionsimportSaveOptions,AnnotationType# Save to a streamwithAnnotator("document.pdf")asannotator:# add annotations herebuf=io.BytesIO()annotator.save(buf)# BytesIO is updated after savedata=buf.getvalue()# Save to a file with filtering optionsoptions=SaveOptions()options.annotation_types=AnnotationType.AREA# render only area annotationsoptions.first_page=1# 1‑based page indexoptions.last_page=2withAnnotator("document.pdf")asannotator:# add annotations hereannotator.save("filtered.pdf",saveOptions=options)
save
Saves document after adding, updating or removing annotations.
importiofromgroupdocs.annotationimportAnnotatorfromgroupdocs.annotation.optionsimportSaveOptions,AnnotationType# Save to a streamwithAnnotator("document.pdf")asannotator:# add annotations herebuffer=io.BytesIO()annotator.save(buffer)# buffer now contains the PDF bytesdata=buffer.getvalue()# Save with options (filter by type and page range)withAnnotator("document.pdf")asannotator:# add annotations hereoptions=SaveOptions()options.annotation_types=AnnotationType.AREA# render only area annotationsoptions.first_page=1# 1‑based page numbersoptions.last_page=2annotator.save("filtered.pdf",save_options=options)