Back to Devexpress

PdfPageFacade.AddTextAnnotation(PdfPoint, String) Method

officefileapi-devexpress-dot-pdf-dot-pdfpagefacade-dot-addtextannotation-x28-devexpress-dot-pdf-dot-pdfpoint-system-dot-string-x29.md

latest3.0 KB
Original Source

PdfPageFacade.AddTextAnnotation(PdfPoint, String) Method

Adds a text annotation at the specified point on the page.

Namespace : DevExpress.Pdf

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

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public PdfTextAnnotationFacade AddTextAnnotation(
    PdfPoint point,
    string iconName
)
vb
Public Function AddTextAnnotation(
    point As PdfPoint,
    iconName As String
) As PdfTextAnnotationFacade

Parameters

NameTypeDescription
pointPdfPoint

The point on the page to position the text annotation.

|

Optional Parameters

NameTypeDefaultDescription
iconNameString"Note"

The name of the annotation icon.

|

Returns

TypeDescription
PdfTextAnnotationFacade

An object that contains text annotation properties.

|

Example

The code sample below creates a sticky note at the specified point on the first page:

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

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

  // Add sticky note at the specified point
  PdfTextAnnotationFacade textAnnotation =
     page.AddTextAnnotation(new PdfPoint(64, 65), PdfTextAnnotationIconName.Cross);

  // Specify annotation parameters
  textAnnotation.Author = "Nancy Davolio";
  textAnnotation.Color = new PdfRGBColor(0.8, 0.2, 0.1);
  textAnnotation.Contents = "Please proofread this document";
}
vb
Using processor As New PdfDocumentProcessor()
  ' Load a document
  processor.LoadDocument("..\..\Document.pdf")

  ' Access the first page properties
  Dim facade As PdfDocumentFacade = processor.DocumentFacade
  Dim page As PdfPageFacade = facade.Pages(0)

  ' Add sticky note at the specified point
  Dim textAnnotation As PdfTextAnnotationFacade =
     page.AddTextAnnotation(New PdfPoint(64, 65), PdfTextAnnotationIconName.Cross)

  ' Specify annotation parameters
  textAnnotation.Author = "Nancy Davolio"
  textAnnotation.Color = New PdfRGBColor(0.8, 0.2, 0.1)
  textAnnotation.Contents = "Please proofread this document"
End Using

See Also

PdfPageFacade Class

PdfPageFacade Members

DevExpress.Pdf Namespace