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

PdfPageWord Class

An individual word related to a specific PDF page.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v24.2.dll

NuGet Package: DevExpress.Document.Processor

#Declaration

public class PdfPageWord :
    PdfWord

The following members return PdfPageWord objects:

#Remarks

The PdfPageWord class uses the page coordinate system. Refer to the Coordinate Systems topic for more information.

Use the PageNumber property of this class to obtain the page number corresponding to a specific word in a PDF. The Characters property provides access to the character settings of a word.

In PDF Document API, a PdfPageWord instance is returned by the PdfDocumentProcessor.NextWord and PdfDocumentProcessor.PrevWord methods.

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
        PdfPageWord 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())));
}

#Inheritance

Object
PdfWord
PdfPageWord
See Also