The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

PdfWord.Rectangles Property

Returns rectangles surrounding the word.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v19.1.Core.dll

Declaration

public IList<PdfOrientedRectangle> Rectangles { get; }
Public ReadOnly Property Rectangles As IList(Of PdfOrientedRectangle)
public IList<PdfOrientedRectangle> Rectangles { get; }
Public ReadOnly Property Rectangles As IList(Of PdfOrientedRectangle)

Property Value

Type Description
IList<PdfOrientedRectangle>

A collection of PdfOrientedRectangle values.

Property Value

Type Description
IList<PdfOrientedRectangle>

A collection of PdfOrientedRectangle values.

Remarks

Tip

The PdfWord.Rectangles property returns more than one DevExpress.Pdf.PdfOrientedRectangle object when a part of a word is carried over to the next line. Use the PdfWord.Segments property to obtain information about each part of the word.

//Declare a list to store the word and its coordinates
List<Tuple<string, PdfOrientedRectangle>> WordCoordinates = new List<Tuple<string, PdfOrientedRectangle>>();
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    processor.LoadDocument("Document.pdf");
    PdfWord currentWord = processor.NextWord();
    while (currentWord != null)
    {
        for (int i = 0; i < currentWord.Rectangles.Count; i++)
        {
            //Retrieve the rectangle encompassing the word
            var wordRectangle = currentWord.Rectangles[i];

            //Add the segment's content and its coordinates to the list
            WordCoordinates.Add(new Tuple<string, PdfOrientedRectangle>(currentWord.Segments[i].Text, wordRectangle));
        }
        //Switch to the next word
        currentWord = processor.NextWord();
    }
}
See Also