PdfFreeTextAnnotationFacade.TextRectangle Property
Gets or sets the text box rectangle.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Pdf.v24.1.Core.dll
NuGet Package: DevExpress.Pdf.Core
Declaration
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