[]
        
(Showing Draft Content)

Circle Annotation

A circle annotation displays an ellipse or circle on a page. When open, the annotation displays a pop-up window with the text of the associated note. GcPdf provides CircleAnnotation class to enable users to apply circle annotations to the PDF file.

Note that a circle annotation does not always imply that the annotation is circular in shape. The height and width of the annotation may vary. The image given below depicts an ellipse-shaped circle annotation.

image

CircleAnnotation class provides the following properties to set various options for the circle annotation:

Property

Description

UserName

Adds the user name to the text label in the title bar of the annotation’s pop-up window when the annotation is open and active.

Subject

Adds the text representing the subject of the annotation.

Contents

Adds the text to the annotation for display.

RichText

Adds the text to the annotation for display in the pop-up window when opened. You can format this text using HTML tags.

Opacity

Sets the opacity of the annotation.

FillColor

Sets the fill color.

LineWidth

Sets the line width in points.

LineDashPattern

Sets the border line pattern to a dash pattern. Null means a solid line.

Color

Sets the annotation color, popup window color, line color, etc.

PdfRect

Sets the rectangle that defines the location and size of the annotation on a page in PDF user space coordinates. The positive X axis extends horizontally to the right, and the positive Y axis extends vertically upward, with the origin usually in the lower left corner of the page.

Refer to the following example code to add a circle annotation to a PDF document:

public void CreateCircleAnnotation()
{
    GcPdfDocument doc = new GcPdfDocument();
    Page page = doc.NewPage();
    RectangleF rc = new RectangleF(50, 50, 120, 50);
    page.Graphics.DrawString("A circle annotation drawn with a 3pt wide green line",
        new TextFormat() { Font = StandardFonts.Times, FontSize = 11 }, rc); rc.Inflate(15, 24);

    //Create an instance of CircleAnnotation class and set its relevant properties
    var circleAnnot = new CircleAnnotation()
    {
        UserName = "Jaime Smith",
        PdfRect = rc,
        LineWidth = 3,
        Color = Color.Green,
        Contents = "This is a circle annotation",
    };

    page.Annotations.Add(circleAnnot); //Add the circle annotation
    doc.Save("CircleAnnotation.pdf");
}