Table of Contents

Class PdfInkAnnotation

Namespace
Syncfusion.Pdf.Interactive
Assembly
Syncfusion.Pdf.Portable.dll

Represents the ink annotation class.

public class PdfInkAnnotation : PdfAnnotation, INotifyPropertyChanged
Inheritance
PdfInkAnnotation
Implements
Inherited Members

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//set the points
List(float) linePoints = new List(float) { 40, 300, 60, 100, 40, 50, 40, 300 };
//Create a new ink annotation
RectangleF rectangle = new RectangleF(0, 0, 300, 400);
//Create a inkAnnotation and set the properties
PdfInkAnnotation inkAnnotation = new PdfInkAnnotation(rectangle, linePoints);
inkAnnotation.Color = new PdfColor(Color.Red);
inkAnnotation.BorderWidth = 4;
inkAnnotation.BorderStyle = PdfLineBorderStyle.Beveled;
//Add annotation to the page
page.Annotations.Add(inkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'set the points
Dim linePoints As New List(Of Single) (New Single() {40, 300, 60, 100, 40, 50, 40, 300})
'Create a new ink annotation 
Dim rectangle As New RectangleF(0, 0, 300, 400)
'Create a inkAnnotation and set the properties
Dim inkAnnotation As New PdfInkAnnotation(rectangle, linePoints)
inkAnnotation.Color = New PdfColor(Color.Red)
inkAnnotation.BorderWidth = 4
inkAnnotation.BorderStyle = PdfLineBorderStyle.Beveled
'Add annotation to the page
page.Annotations.Add(inkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)

Remarks

Please refer the UG docuemntation link for more details.

Constructors

PdfInkAnnotation(RectangleF, List<float>)

Initializes a new instance of the PdfInkAnnotation class with specified bounds and line points.

public PdfInkAnnotation(RectangleF rectangle, List<float> linePoints)

Parameters

rectangle RectangleF

The bounds of the annotation

linePoints List<float>

The list of points to be drawn.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//set the points
List<float> linePoints = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
//Create a new ink annotation
RectangleF rectangle = new RectangleF(0, 0, 300, 400);
//Create a ink annotation
PdfInkAnnotation inkAnnotation = new PdfInkAnnotation(rectangle, linePoints);
inkAnnotation.Color = new PdfColor(Color.Red);
//Add annotation to the page
page.Annotations.Add(inkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'set the points
Dim linePoints As New List(Of Single) (New Single() {40, 300, 60, 100, 40, 50, 40, 300})
'Create a new ink annotation
Dim rectangle As New RectangleF(0, 0, 300, 400)
'Create a ink annotation
Dim inkAnnotation As New PdfInkAnnotation(rectangle, linePoints)
inkAnnotation.Color = New PdfColor(Color.Red)
'Add annotation to the page
page.Annotations.Add(inkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

Properties

BorderStyle

Gets or sets the border style of an ink annotation.

public PdfLineBorderStyle BorderStyle { get; set; }

Property Value

PdfLineBorderStyle

A PdfLineBorderStyle enumeration member specifying the line border Style of the line annotation.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//set the points
List<float> linePoints = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
//Create a new ink annotation
RectangleF rectangle = new RectangleF(0, 0, 300, 400);
//Create a inkAnnotation and set the properties
PdfInkAnnotation inkAnnotation = new PdfInkAnnotation(rectangle, linePoints);
inkAnnotation.Color = new PdfColor(Color.Red);
inkAnnotation.BorderWidth = 4;
inkAnnotation.BorderStyle = PdfLineBorderStyle.Beveled;
inkAnnotation.InkList = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
inkAnnotation.DashArray = new int[] { 0, 0 };
//Add annotation to the page
page.Annotations.Add(inkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'set the points
Dim linePoints As New List(Of Single) (New Single() {40, 300, 60, 100, 40, 50, 40, 300})
'Create a new ink annotation 
Dim rectangle As New RectangleF(0, 0, 300, 400)
'Create a inkAnnotation and set the properties
Dim inkAnnotation As New PdfInkAnnotation(rectangle, linePoints)
inkAnnotation.Color = New PdfColor(Color.Red)
inkAnnotation.BorderWidth = 4
inkAnnotation.BorderStyle = PdfLineBorderStyle.Beveled
inkAnnotation.DashArray = New Integer() {0, 0}
'Add annotation to the page
page.Annotations.Add(inkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

BorderWidth

Gets or sets the border width of an ink annotation.

public int BorderWidth { get; set; }

Property Value

int

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//set the points
List<float> linePoints = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
//Create a new ink annotation
RectangleF rectangle = new RectangleF(0, 0, 300, 400);
//Create a inkAnnotation and set the properties
PdfInkAnnotation inkAnnotation = new PdfInkAnnotation(rectangle, linePoints);
inkAnnotation.Color = new PdfColor(Color.Red);
inkAnnotation.BorderWidth = 4;
inkAnnotation.BorderStyle = PdfLineBorderStyle.Beveled;
 inkAnnotation.InkList = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
 inkAnnotation.DashArray = new int[] { 0, 0 };
//Add annotation to the page
page.Annotations.Add(inkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'set the points
Dim linePoints As New List(Of Single) (New Single() {40, 300, 60, 100, 40, 50, 40, 300})
'Create a new ink annotation 
Dim rectangle As New RectangleF(0, 0, 300, 400)
'Create a inkAnnotation and set the properties
Dim inkAnnotation As New PdfInkAnnotation(rectangle, linePoints)
inkAnnotation.Color = New PdfColor(Color.Red)
inkAnnotation.BorderWidth = 4
inkAnnotation.BorderStyle = PdfLineBorderStyle.Beveled
inkAnnotation.DashArray = New Integer() {0, 0}
'Add annotation to the page
page.Annotations.Add(inkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

Comments

Gets the annotation comments

public PdfPopupAnnotationCollection Comments { get; }

Property Value

PdfPopupAnnotationCollection

Examples

//Creates a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page
PdfPage page = document.Pages.Add();
List<float> linePoints = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
//Creates a new ink annotation
RectangleF rectangle = new RectangleF(0, 0, 300, 400);
PdfInkAnnotation inkAnnotation = new PdfInkAnnotation(rectangle, linePoints);
inkAnnotation.Color = new PdfColor(Color.Red);
//Add Comment State
PdfPopupAnnotation popupComments = new PdfPopupAnnotation();
popupComments.Author = "TestAuthor";
popupComments.Text = "Test Text";
inkAnnotation.Comments.Add(popupComments);
//Get annotation comments
PdfPopupAnnotationCollection commentsCollection = inkAnnotation.Comments;
//Saves the document to disk.
document.Save("Output.pdf");
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim linePoints As List(Of Single) = New List(Of Single)() {40, 300, 60, 100, 40, 50, 40, 300}
Dim rectangle As RectangleF = New RectangleF(0, 0, 300, 400)
Dim inkAnnotation As PdfInkAnnotation = New PdfInkAnnotation(rectangle, linePoints)
inkAnnotation.Color = New PdfColor(Color.Red)
Dim popupComments As PdfPopupAnnotation = New PdfPopupAnnotation
popupComments.Author = "TestAuthor"
popupComments.Text = "Test Text"
inkAnnotation.Comments.Add(popupComments)
Dim commentsCollection As PdfPopupAnnotationCollection = inkAnnotation.Comments
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)
See Also

DashArray

Gets or sets the DashArray value

public int[] DashArray { get; set; }

Property Value

int[]

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//set the points
List<float> linePoints = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
//Create a new ink annotation
RectangleF rectangle = new RectangleF(0, 0, 300, 400);
//Create a inkAnnotation and set the properties
PdfInkAnnotation inkAnnotation = new PdfInkAnnotation(rectangle, linePoints);
inkAnnotation.Color = new PdfColor(Color.Red);
inkAnnotation.BorderWidth = 4;
inkAnnotation.BorderStyle = PdfLineBorderStyle.Beveled;
inkAnnotation.InkList = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
 inkAnnotation.DashArray = new int[] { 0, 0 };
//Add annotation to the page
page.Annotations.Add(inkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'set the points
Dim linePoints As New List(Of Single) (New Single() {40, 300, 60, 100, 40, 50, 40, 300})
'Create a new ink annotation 
Dim rectangle As New RectangleF(0, 0, 300, 400)
'Create a inkAnnotation and set the properties
Dim inkAnnotation As New PdfInkAnnotation(rectangle, linePoints)
inkAnnotation.Color = New PdfColor(Color.Red)
inkAnnotation.BorderWidth = 4
inkAnnotation.BorderStyle = PdfLineBorderStyle.Beveled
inkAnnotation.DashArray = New Integer() {0, 0}
'Add annotation to the page
page.Annotations.Add(inkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

InkList

Gets or sets list of the InkList value.

public List<float> InkList { get; set; }

Property Value

List<float>

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//set the points
List<float> linePoints = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
//Create a new ink annotation
RectangleF rectangle = new RectangleF(0, 0, 300, 400);
//Create a inkAnnotation and set the properties
PdfInkAnnotation inkAnnotation = new PdfInkAnnotation(rectangle, linePoints);
inkAnnotation.Color = new PdfColor(Color.Red);
inkAnnotation.BorderWidth = 4;
inkAnnotation.BorderStyle = PdfLineBorderStyle.Beveled;
inkAnnotation.InkList = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
inkAnnotation.DashArray = new int[] { 0, 0 };
//Add annotation to the page
page.Annotations.Add(inkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'set the points
Dim linePoints As New List(Of Single) (New Single() {40, 300, 60, 100, 40, 50, 40, 300})
'Create a new ink annotation 
Dim rectangle As New RectangleF(0, 0, 300, 400)
'Create a inkAnnotation and set the properties
Dim inkAnnotation As New PdfInkAnnotation(rectangle, linePoints)
inkAnnotation.Color = New PdfColor(Color.Red)
inkAnnotation.BorderWidth = 4
inkAnnotation.BorderStyle = PdfLineBorderStyle.Beveled
inkAnnotation.DashArray = New Integer() {0, 0}
'Add annotation to the page
page.Annotations.Add(inkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

InkPointsCollection

Gets or sets multiple list of the InkList value.

public List<List<float>> InkPointsCollection { get; set; }

Property Value

List<List<float>>

Examples

//Create a new PDF document
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
List<float> inkPoints1 = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
List<float> inkPoints2 = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
//Creates a new ink annotation
RectangleF rectangle = new RectangleF(0, 0, 300, 400);
PdfInkAnnotation inkAnnotation = new PdfInkAnnotation(rectangle, inkPoints1);
//Adds ink points into ink points collection
inkAnnotation.InkPointsCollection.Add(inkPoints2);
//Sets color for ink annotation
inkAnnotation.Color = new PdfColor(Color.Red);
//Adds annotation to the page
page.Annotations.Add(inkAnnotation);
//Save and close the PDF document
document.Save("Output.pdf");
document.Close(true);
'Create a new PDF document
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
Dim inkPoints1 As New List(Of Single)(New Single() { 40, 300, 60, 100, 40, 50, 40, 300 })
Dim inkPoints1 As New List(Of Single)(New Single() { 40, 300, 60, 500, 40, 450, 40, 300 })
'Creates a new ink annotation
Dim rectangle As New RectangleF(0, 0, 300, 400)
Dim inkAnnotation As New PdfInkAnnotation(rectangle, inkPoints1)
///  'Adds ink points into ink points collection
inkAnnotation.InkPointsCollection.Add(inkPoints2)
'Sets color for ink annotation
inkAnnotation.Color = New PdfColor(Color.Red)
'Adds annotation to the page
page.Annotations.Add(inkAnnotation)
'Save and close the PDF document
document.Save("Output.pdf")
document.Close(True)
See Also

ReviewHistory

Gets the annotation reviews

public PdfPopupAnnotationCollection ReviewHistory { get; }

Property Value

PdfPopupAnnotationCollection

Examples

 //Creates a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page
PdfPage page = document.Pages.Add();
List<float> linePoints = new List<float> { 40, 300, 60, 100, 40, 50, 40, 300 };
//Creates a new ink annotation
RectangleF rectangle = new RectangleF(0, 0, 300, 400);
PdfInkAnnotation inkAnnotation = new PdfInkAnnotation(rectangle, linePoints);
inkAnnotation.Color = new PdfColor(Color.Red);
//Add review State
PdfPopupAnnotation popup = new PdfPopupAnnotation();
popup.State = PdfAnnotationState.Accepted;
popup.StateModel = PdfAnnotationStateModel.Review;
popup.Text = "Hello PDF Comments";
inkAnnotation.ReviewHistory.Add(popup);
//Get Review history
PdfPopupAnnotationCollection reviewCollection = inkAnnotation.ReviewHistory;
//Saves the document to disk.
document.Save("Output.pdf");
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim linePoints As List(Of Single) = New List(Of Single)() {40, 300, 60, 100, 40, 50, 40, 300}
Dim rectangle As RectangleF = New RectangleF(0, 0, 300, 400)
Dim inkAnnotation As PdfInkAnnotation = New PdfInkAnnotation(rectangle, linePoints)
inkAnnotation.Color = New PdfColor(Color.Red)
Dim popup As PdfPopupAnnotation = New PdfPopupAnnotation
popup.State = PdfAnnotationState.Accepted
popup.StateModel = PdfAnnotationStateModel.Review
popup.Text = "Hello PDF Comments"
inkAnnotation.ReviewHistory.Add(popup)
Dim reviewCollection As PdfPopupAnnotationCollection = inkAnnotation.ReviewHistory
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)
See Also

Methods

Initialize()

Initializes annotation object.

protected override void Initialize()
See Also

Save()

Saves an annotation.

protected override void Save()
See Also

See Also