Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfFreeTextAnnotationFacade.TextRectangle Property

Gets or sets the text box rectangle.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v24.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