GroupDocs.Annotation API

GroupDocs.Annotation comes with an extensive set of tools that you can use to easily add common shapes to your documents as an annotation. The list of tools is not limited to area, point, text, polyline, etc. In this section, we will primarily discuss how the Ellipse annotation could be added in a PDF document by using GroupDocs.Annotation API.

Adding Ellipse Annotation

While discussing the family of annotation types, we cannot ignore ellipse annotation. It could be regarded as a multi-purposed annotation type. For example, it could be used to display extra information on your graphs or you can use it to circle important information. AnnotationInfo could be used to set color, page, opacity, creator name and many more. At minimum following two properties of AnnotationInfo have to be set for drawing an ellipse, which determine the size and type of the annotation:
Fixed value_AnnotationType.Ellipse_ is always used as Type for adding an Ellipse Annotation_._

Code Example for a PDF Document

For adding ellipse to a PDF document, first we will need to get the document in form of Stream by using following line of code:

Then the Ellipse annotation is added to the list of annotations:
Finally, we will export the annotation and save the output file:
This way we have added an Ellipse annotation to our PDF document using GroupDocs.Annotation API.

The complete C# code will look like this:

The code in Java will look like this:
[gist id=“705c29f24cf3c7a5efffe88768bde0a0” file=addingEllipseAnnotationInPDF.Java"] After adding Ellipse annotation the output document will looks like following screenshot: