Skip to main content

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

PdfDocumentProcessor.GetText(PdfDocumentPosition, PdfDocumentPosition) Method

Retrieves the text located between the specified document positions.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v24.2.dll

NuGet Package: DevExpress.Document.Processor

#Declaration

public string GetText(
    PdfDocumentPosition startPosition,
    PdfDocumentPosition endPosition
)

#Parameters

Name Type Description
startPosition PdfDocumentPosition

A PdfDocumentPosition object that is the initial document position.

endPosition PdfDocumentPosition

A PdfDocumentPosition object that is the final document position.

#Returns

Type Description
String

A String value that is the target the text.

#Remarks

The overloaded GetText method uses the page coordinate system. See the following help topic to learn more: Coordinate Systems.

If there is no text between the specified positions, this method returns text that is nearest to these positions.

using (DevExpress.Pdf.PdfDocumentProcessor processor = new DevExpress.Pdf.PdfDocumentProcessor())
{
    processor.LoadDocument("TextExtraction.pdf");
    PdfDocumentPosition startPosition = new PdfDocumentPosition(1, new PdfPoint(0, 0));
    PdfDocumentPosition endPosition = new PdfDocumentPosition(1, new PdfPoint(500, 500));

    string pageText = processor.GetText(startPosition, endPosition);
    Console.WriteLine(pageText);
}
See Also