PDF Mosaic: How to create line annotations


Home       Features       Download       Tutorial       Version History       License       PDF Mosaic Blog       Source Code

 

This sample shows how to add line annotation to your PDF document.

How to add line annotation to your PDF document in PDF Mosaic library
 

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);
 
      PDFLineAnnotation lineAnnotation1 = new PDFLineAnnotation(50, 50, 100, 110);
      lineAnnotation1.Color = new PDFColorRGB(255, 0, 0);
      page.Annotations.Add(lineAnnotation1);
 
      PDFLineAnnotation lineAnnotation2 = new PDFLineAnnotation(100, 50, 150, 110);
      lineAnnotation2.Color = new PDFColorRGB(0, 255, 0);
      lineAnnotation2.StartLineStyle = PDFLineEndingStyle.Diamond;
      page.Annotations.Add(lineAnnotation2);
 
      PDFLineAnnotation lineAnnotation3 = new PDFLineAnnotation(150, 50, 200, 110);
      lineAnnotation3.Color = new PDFColorRGB(0, 0, 255);
      lineAnnotation3.StartLineStyle = PDFLineEndingStyle.Diamond;
      lineAnnotation3.EndLineStyle = PDFLineEndingStyle.OpenArrow;
      page.Annotations.Add(lineAnnotation3);
 
      document.Pages.Add(page);
      document.Save("LineAnnotation.pdf", true);
    }
  }
}

 

Visial Basic.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 lineAnnotation1 As New PDFLineAnnotation(50, 50, 100, 110)
    lineAnnotation1.Color = New PDFColorRGB(255, 0, 0)
    page.Annotations.Add(lineAnnotation1)
 
    Dim lineAnnotation2 As New PDFLineAnnotation(100, 50, 150, 110)
    lineAnnotation2.Color = New PDFColorRGB(0, 255, 0)
    lineAnnotation2.StartLineStyle = PDFLineEndingStyle.Diamond
    page.Annotations.Add(lineAnnotation2)
 
    Dim lineAnnotation3 As New PDFLineAnnotation(150, 50, 200, 110)
    lineAnnotation3.Color = New PDFColorRGB(0, 0, 255)
    lineAnnotation3.StartLineStyle = PDFLineEndingStyle.Diamond
    lineAnnotation3.EndLineStyle = PDFLineEndingStyle.OpenArrow
    page.Annotations.Add(lineAnnotation3)
 
    document.Pages.Add(page)
    document.Save("LineAnnotation.pdf", True)
  End Sub
End Module

 


Home       Features       Download       Tutorial       Version History       License       PDF Mosaic Blog       Source Code