Class PdfInkAnnotation
Represents the ink annotation class.
Implements
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfInkAnnotation : PdfAnnotation, IPdfWrapper, INotifyPropertyChanged
Remarks
Please refer the UG docuemntation link https://help.syncfusion.com/file-formats/pdf/working-with-annotations#ink-annotation for more details.
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)
Constructors
PdfInkAnnotation(RectangleF, List<Single>)
Initializes a new instance of the PdfInkAnnotation class with specified bounds and line points.
Declaration
public PdfInkAnnotation(RectangleF rectangle, List<float> linePoints)
Parameters
Type | Name | Description |
---|---|---|
RectangleF | rectangle | The bounds of the annotation |
System.Collections.Generic.List<System.Single> | linePoints | 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.
Declaration
public PdfLineBorderStyle BorderStyle { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public int BorderWidth { get; set; }
Property Value
Type |
---|
System.Int32 |
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
Declaration
public PdfPopupAnnotationCollection Comments { get; }
Property Value
Type |
---|
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)
DashArray
Gets or sets the DashArray value
Declaration
public int[] DashArray { get; set; }
Property Value
Type |
---|
System.Int32[] |
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.
Declaration
public List<float> InkList { get; set; }
Property Value
Type |
---|
System.Collections.Generic.List<System.Single> |
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.
Declaration
public List<List<float>> InkPointsCollection { get; set; }
Property Value
Type |
---|
System.Collections.Generic.List<System.Collections.Generic.List<System.Single>> |
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)
ReviewHistory
Gets the annotation reviews
Declaration
public PdfPopupAnnotationCollection ReviewHistory { get; }
Property Value
Type |
---|
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)
Methods
Initialize()
Initializes annotation object.
Declaration
protected override void Initialize()
Overrides
Save()
Saves an annotation.
Declaration
protected override void Save()