.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

PdfDocumentProcessor.FindText(String) Method

Searches for the specified text in the current document with default parameters.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v21.1.dll

Declaration

public PdfTextSearchResults FindText(
    string text
)

Parameters

Name Type Description
text String

A String value, specifying the text to find in the PDF.

Returns

Type Description
PdfTextSearchResults

A PdfTextSearchResults object.

Remarks

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

The code sample below counts all words in a document.

using DevExpress.Pdf;
using DevExpress.XtraBars;
using DevExpress.XtraEditors;
using System.IO;
using System.Text;
using System.Windows.Forms;
// ...
        private int WordCount(string filePath, string word) {
            int count = 0;
            try {
                using (PdfDocumentProcessor documentProcessor = new PdfDocumentProcessor()) {
                    documentProcessor.LoadDocument(filePath);
                    while (documentProcessor.FindText(word).Status == PdfTextSearchStatus.Found) {
                        count++;
                    }
                }
            }
            catch { }

            return count;
        }
See Also