How To Add Caret Annotation To PDF Documents Using PDF Mosaic .NET

This sample shows how to add caret annotations to your PDF document.

Use PDFCaretAnnotation class to add caret annotation.

Caret Annotation

 

using PDFMosaic;
using System;

namespace PDFCaretAnnotationSample
{
    class PDFCaretAnnotationSample
    {
        static void Main()
        {
            PDFDocument pdf = new PDFDocument();
			pdf = new PDFDocument();
            pdf.Pages.Add(new PDFPage(PDFPaperFormat.A4));
            PDFCaretAnnotation annot = new PDFCaretAnnotation(10, 10, 20, 20);
            annot.Color = new PDFColorRGB(0, 0, 0);
            annot.Symbol = PDFCaretSymbol.Paragraph;
            pdf.Pages[0].Annotations.Add(annot);
            annot = new PDFCaretAnnotation(40, 30, 20, 20);
            annot.Color = new PDFColorRGB(0, 255, 0);
            annot.Symbol = PDFCaretSymbol.None;
            pdf.Pages[0].Annotations.Add(annot);
            pdf.Save("TestCaretAnnotation.pdf", true);
        }
    }
}