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

PdfDocumentProcessor.GetText(PdfDocumentArea) Method

Selects the text found within the specified document area.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v19.1.dll

Declaration

public string GetText(
    PdfDocumentArea area
)

Parameters

Name Type Description
area PdfDocumentArea

A PdfDocumentArea object.

Returns

Type Description
String

A String value, specifying the text.

Remarks

The overloaded GetText method uses the page coordinate system. Refer to the Coordinate Systems topic for more details.

The code sample below retrieves text from the specific part of the document

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    processor.LoadDocument("TextExtraction.pdf");
    PdfPage page = processor.Document.Pages[0];

    PdfRectangle pdfRectangle = new PdfRectangle(page.CropBox.Left / 3, page.CropBox.Bottom, page.CropBox.Right / 3, page.CropBox.Top);
    PdfDocumentArea pageArea = new PdfDocumentArea(1, pdfRectangle);

    string pageText = processor.GetText(pageArea);
    Console.WriteLine(pageText);
}
See Also