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

PdfDocumentProcessor.FindText(String) Method

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

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v20.2.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