Back to Devexpress

PdfPageFacade.AddLineAnnotation(PdfPoint, PdfPoint) Method

officefileapi-devexpress-dot-pdf-dot-pdfpagefacade-dot-addlineannotation-x28-devexpress-dot-pdf-dot-pdfpoint-devexpress-dot-pdf-dot-pdfpoint-x29.md

latest3.4 KB
Original Source

PdfPageFacade.AddLineAnnotation(PdfPoint, PdfPoint) Method

Creates a line annotation between the specified points.

Namespace : DevExpress.Pdf

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

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public PdfLineAnnotationFacade AddLineAnnotation(
    PdfPoint start,
    PdfPoint end
)
vb
Public Function AddLineAnnotation(
    start As PdfPoint,
    end As PdfPoint
) As PdfLineAnnotationFacade

Parameters

NameTypeDescription
startPdfPoint

The start point of the annotation.

| | end | PdfPoint |

The end point of the annotation.

|

Returns

TypeDescription
PdfLineAnnotationFacade

An object that contains the line annotation properties.

|

Example

The code sample below creates a red line annotation:

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

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

    // Define an annotation's start and end points
    PdfPoint start = new PdfPoint(100, 100);
    PdfPoint end = new PdfPoint(150, 100);

    // Add a line annotation
    PdfLineAnnotationFacade lineAnnotation = pageFacade.AddLineAnnotation(start, end);

    // Specify the annotation parameters
    lineAnnotation.Author = "Brian Zetc";
    lineAnnotation.BorderStyle = PdfBorderStyle.DashDot;
    lineAnnotation.BorderWidth = 3;
    lineAnnotation.Color = new PdfRGBColor(0.8, 0.2, 0.1);
    lineAnnotation.Contents = "Made in PDF Document API";

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

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

  ' Define an annotation's start and end points
  Dim start As New PdfPoint(100, 100)
  Dim [end] As New PdfPoint(150, 100)

  ' Add a line annotation
  Dim lineAnnotation As PdfLineAnnotationFacade = pageFacade.AddLineAnnotation(start, [end])

  ' Specify the annotation parameters
  lineAnnotation.Author = "Brian Zetc"
  lineAnnotation.BorderStyle = PdfBorderStyle.DashDot
  lineAnnotation.BorderWidth = 3
  lineAnnotation.Color = New PdfRGBColor(0.8, 0.2, 0.1)
  lineAnnotation.Contents = "Made in PDF Document API"

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

See Also

PdfPageFacade Class

PdfPageFacade Members

DevExpress.Pdf Namespace