How To Create Square Annotation in PDF Mosaic Library .NET

This sample shows how to square annotation to your PDF document.

C# :

using PDFMosaic;
using System;
using System.Drawing;

namespace MarkupAnnotations
{
  class MarkupAnnotations
  {
    static void Main()
    {
      PDFDocument document = new PDFDocument();
      PDFPage page = new PDFPage(PDFPaperFormat.A4);


      PDFSquareAnnotation squareAnnotation = new PDFSquareAnnotation(60, 60, 80, 50);
      squareAnnotation.BorderEffect.Effect = PDFBorderEffect.Cloudy;
      squareAnnotation.BorderEffect.Intensity = 2;
      squareAnnotation.BackgroundColor = new PDFColorRGB(255, 0, 0);
      page.Annotations.Add(squareAnnotation);


      document.Pages.Add(page);
      document.Save("SquareAnnotation.pdf", true);
    }
  }
}

VB.NET :

Imports PDFMosaic
Imports System
Imports System.Drawing

Module MarkupAnnotations
  Sub Main()
    Dim document As New PDFDocument()
    Dim page As New PDFPage(PDFPaperFormat.A4)

    Dim squareAnnotation As New PDFSquareAnnotation(60, 60, 80, 50)
    squareAnnotation.BackgroundColor = New PDFColorRGB(255, 0, 0)
    squareAnnotation.BorderEffect.Effect = PDFBorderEffect.Cloudy
    squareAnnotation.BorderEffect.Intensity = 2
    page.Annotations.Add(squareAnnotation)

    document.Pages.Add(page)
    document.Save("SquareAnnotation.pdf", True)
  End Sub
End Module