Back to Devexpress

PdfPageFacade.AddSquareAnnotation(PdfRectangle) Method

officefileapi-devexpress-dot-pdf-dot-pdfpagefacade-dot-addsquareannotation-x28-devexpress-dot-pdf-dot-pdfrectangle-x29.md

latest3.0 KB
Original Source

PdfPageFacade.AddSquareAnnotation(PdfRectangle) Method

Creates a square annotation in the specified page rectangle.

Namespace : DevExpress.Pdf

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

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public PdfSquareAnnotationFacade AddSquareAnnotation(
    PdfRectangle rect
)
vb
Public Function AddSquareAnnotation(
    rect As PdfRectangle
) As PdfSquareAnnotationFacade

Parameters

NameTypeDescription
rectPdfRectangle

The page area to create the square annotation.

|

Returns

TypeDescription
PdfSquareAnnotationFacade

An object that contains square annotation properties.

|

Example

The code sample below creates a square 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 the area to add an annotation
    PdfRectangle rectangle = new PdfRectangle(663, 526, 763, 576);

    // Create a square annotation
    PdfSquareAnnotationFacade squareAnnotation = pageFacade.AddSquareAnnotation(rectangle);

    // Specify annotation parameters
    squareAnnotation.Author = "Nancy Davolio";
    squareAnnotation.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 the area to add an annotation
  Dim rectangle As New PdfRectangle(663, 526, 763, 576)

  ' Create a square annotation
  Dim squareAnnotation As PdfSquareAnnotationFacade = pageFacade.AddSquareAnnotation(rectangle)

  ' Specify annotation parameters
  squareAnnotation.Author = "Nancy Davolio"
  squareAnnotation.Contents = "Made in PDF Document API"

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

See Also

PdfPageFacade Class

PdfPageFacade Members

DevExpress.Pdf Namespace