ParagraphAbsorber Class
Represents an absorber object of page structure objects such as sections and paragraphs. Performs search for sections and paragraphs of text and provides access for rectangles and polydons that describes it in text coordinate space. Also performs text segments search and provides access to search results via [!:TextFragments] collections grouped by structure elements.
Inheritance Hierarchy

Namespace: Aspose.Pdf.Text
Assembly: Aspose.PDF (in Aspose.PDF.dll) Version: 20.3
public class ParagraphAbsorber

The ParagraphAbsorber type exposes the following members.

Public methodParagraphAbsorber
Initializes a new instance of the ParagraphAbsorber that performs search for sections/paragraphs of the document or page.
Public methodParagraphAbsorber(Int32)
Initializes a new instance of the ParagraphAbsorber that performs search for sections/paragraphs of the document or page.
Public propertyPageMarkups
Gets collection of PageMarkup that were absorbed.
Public propertySectionsSearchDepth
Gets or sets value that instructs how many times sequential searches for more fine elements of structure will be performed. Default search depth is 3. It means three searches for horizontally divided sections (headers, paragraphs etc) and three searches for vertically divided ones (columns).
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Public methodVisit(Document)
Public methodVisit(Page)
Performs search on the specified Page.
When the search is completed the PageMarkups collection will contains PageMarkup objects that represents page structure by collections of MarkupSection and MarkupParagraph. The TextFragment object provides access to the search occurrence text, text properties, and allows to edit text and change the text state (font, font size, color etc).
The example demonstrates how to find first text segment of each paragraph on the first PDF document page and highlight it.
// Open document
Document doc = new Document("input.pdf");

// Create ParagraphAbsorber object
ParagraphAbsorber absorber = new ParagraphAbsorber();

// Accept the absorber for first page

// Get markup object of first page
PageMarkup markup = absorber.PageMarkups[0];

// Loop through structure elements of the page text to find first text fragment of each paragraph
foreach (MarkupSection section in markup.Sections)
    foreach (MarkupParagraph paragraph in section.Paragraphs)
        TextFragment fragment = paragraph.Fragments[0];
        // Update text properties
        fragment.TextState.BackgroundColor = Color.LightBlue;

// Save document
See Also