Add ellipse annotation

On this page

Ellipse annotation draws elliptic annotation on a document page as shown in the picture below.

You can set the following properties of the EllipseAnnotation class: 

  • BackgroundColor defines the ellipse background color
  • Box defines the annotation position on the page;
  • Opacity allows you to set the annotation opacity
  • PenColor defines the pen color
  • PenStyle - defines the line style (solid, dash, dot etc.)
  • PenWidth defines the line width in pixels. 

To add an ellipse annotation, follow these steps:

  1. Instantiate the Annotator class. Specify the input document path or stream.
  2. Instantiate EllipseAnnotation class. Specify the appropriate properties (position, page number, etc).
  3. Call the Add method. Specify the EllipseAnnotation class.
  4. Call the Save method. Specify the output document path or stream.

The following code snippet shows how to add EllipseAnnotation to the document:

//Add ellipse annotation to the document from local disk
using (Annotator annotator = new Annotator("input.pdf"))
{
	EllipseAnnotation ellipse = new EllipseAnnotation
    {
    	BackgroundColor = 65535,
        Box = new Rectangle(100, 100, 100, 100),
        CreatedOn = DateTime.Now,
        Message = "This is ellipse annotation",
        Opacity = 0.7,
        PageNumber = 0,
        PenColor = 65535,
        PenStyle = PenStyle.Dot,
        PenWidth = 3,
        Replies = new List<Reply>
        {
        	new Reply
            {
            	Comment = "First comment",
                RepliedOn = DateTime.Now
            },
            new Reply
            {
            	Comment = "Second comment",
                RepliedOn = DateTime.Now
            }
       }
   };
   annotator.Add(ellipse);
   annotator.Save("result.pdf");
}

On this page