Back to Devexpress

PdfPageFacade.AddInkAnnotation(IList<IList<PdfPoint>>) Method

officefileapi-devexpress-dot-pdf-dot-pdfpagefacade-dot-addinkannotation-x28-system-dot-collections-dot-generic-dot-ilist-system-dot-collections-dot-generic-dot-ilist-devexpress-dot-pdf-dot-pdfpoint-x29.md

latest3.6 KB
Original Source

PdfPageFacade.AddInkAnnotation(IList<IList<PdfPoint>>) Method

Creates an ink annotation comprised of one or multiple points on the page.

Namespace : DevExpress.Pdf

Assembly : DevExpress.Pdf.v25.2.Core.dll

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public PdfInkAnnotationFacade AddInkAnnotation(
    IList<IList<PdfPoint>> inks
)
vb
Public Function AddInkAnnotation(
    inks As IList(Of IList(Of PdfPoint))
) As PdfInkAnnotationFacade

Parameters

NameTypeDescription
inksIList<IList<PdfPoint>>

A list of points used create an annotation.

|

Returns

TypeDescription
PdfInkAnnotationFacade

An object that contains ink annotation properties.

|

Example

The following code snippet creates an ink annotation:

csharp
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
  // Load a document
  processor.LoadDocument("..\\..\\Document.pdf");

  // Access page properties
  PdfPageFacade pageFacade = processor.DocumentFacade.Pages[0];

  // Define ink vertices
  PdfPoint[] points = new PdfPoint[]
  {
      new PdfPoint(100, 100),
      new PdfPoint(120, 100),
      new PdfPoint(130, 110),
      new PdfPoint(130, 110),
      new PdfPoint(140, 100),
      new PdfPoint(150, 150)
  };

  List<IList<PdfPoint>> inks = new List<IList<PdfPoint>> { points };

  // Create an ink annotation
  PdfInkAnnotationFacade inkAnnotation = pageFacade.AddInkAnnotation(inks);
  inkAnnotation.Author = "Brian Zetc";
  inkAnnotation.BorderWidth = 1.0;

  // Save the result
  processor.SaveDocument("..\\..\\Result.pdf");
}
vb
Using processor As New PdfDocumentProcessor()
  ' Load a document
  processor.LoadDocument("..\..\Document.pdf")

  ' Access page properties
  Dim pageFacade As PdfPageFacade = processor.DocumentFacade.Pages(0)

  ' Define ink vertices
  Dim point1 As New PdfPoint(100, 100)
  Dim point2 As New PdfPoint(110, 110)
  Dim point3 As New PdfPoint(120, 100)
  Dim point4 As New PdfPoint(130, 110)
  Dim point5 As New PdfPoint(140, 100)
  Dim point6 As New PdfPoint(150, 150)
  Dim points() As PdfPoint = { point1, point2, point3, point4, point5, point6 }

  Dim inks As New List(Of IList(Of PdfPoint))() From {points}

  ' Create an ink annotation
  Dim inkAnnotation As PdfInkAnnotationFacade = pageFacade.AddInkAnnotation(inks)
  inkAnnotation.Author = "Brian Zetc"
  inkAnnotation.BorderWidth = 1.0

  ' Save the result
  processor.SaveDocument("..\..\Result.pdf")
End Using

See Also

PdfPageFacade Class

PdfPageFacade Members

DevExpress.Pdf Namespace