Skip to main content
A newer version of this page is available. .
All docs
V21.2
.NET Framework 4.5.2+

PdfFreeTextAnnotationFacade.TextRectangle Property

Gets or sets the text box rectangle.

Namespace: DevExpress.Pdf

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

NuGet Package: DevExpress.Pdf.Core

Declaration

public PdfRectangle TextRectangle { get; set; }

Property Value

Type Description
PdfRectangle

The annotation text rectangle.

Remarks

Use this property to specify the rectangle the text box occupies. The PdfAnnotationFacade.Rectangle property returns the annotation rectangle, which includes the text box and a callout (if specified).

The code sample below resizes the text box rectangle:

using DevExpress.Pdf;
using System.Linq;

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

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

    // Retrieve all free text annotations
    var freeTextAnnotations = pageFacade.Annotations.Where
            (annotation => annotation.Type == PdfAnnotationType.FreeText);
    foreach (PdfFreeTextAnnotationFacade freeText in freeTextAnnotations)
    {
        // Resize the text box:
        PdfPoint center = freeText.Rectangle.Center;
        freeText.TextRectangle = new PdfRectangle(center.X-15, center.Y-15, center.X+15, center.Y+15);
    }
    // Save the result
    processor.SaveDocument("..\\..\\Result.pdf");
}
See Also