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

PdfDocumentProcessor.NextWord() Method

Returns the next word in a PDF document.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v19.1.dll

Declaration

public PdfPageWord NextWord()

Returns

Type Description
PdfPageWord

A PdfPageWord object, providing information about the document page corresponding to the specified word.

Remarks

The NextWord method uses the page coordinate system. See the Coordinate Systems topic to learn more.

The code sample below shows how to use the NextWord method to retrieve the list of document fonts.

static void Main(string[] args)
{
    HashSet<string> FontNames = new HashSet<string>();

    using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
    {
        processor.LoadDocument("Document.pdf");

        //Check all words in the document
        PdfWord currentWord = processor.NextWord();
        while (currentWord != null)
        {
            //Add the current font name to the list
            for (int i = 0; i < currentWord.Characters.Count; i++)
            {
                    FontNames.Add(currentWord.Characters[i].Font.FontName);
            }
            currentWord = processor.NextWord();
        }
    }
    Console.WriteLine(string.Format("The loaded document contains the following fonts:\r\n{0}", 
    string.Join("\r\n", FontNames.ToArray())));
}
See Also