Add area annotation

On this page

Area annotation allows you to mark up a rectangle area within the document page and annotate it as shown in the picture below. 

You can set the following properties of the AreaAnnotation class:

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

To add an area annotation to document, follow these steps:  

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

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

using (Annotator annotator = new Annotator("input.pdf"))
	AreaAnnotation area = new AreaAnnotation
     	BackgroundColor = 65535,
        Box = new Rectangle(100, 100, 100, 100),
        CreatedOn = DateTime.Now,
        Message = "This is area 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

On this page