TextFragmentAbsorber

Inheritance: java.lang.Object, com.aspose.pdf.TextAbsorber

public final class TextFragmentAbsorber extends TextAbsorber

Represents an absorber object of text fragments. Performs text search and provides access to search results via TextFragmentAbsorber.TextFragments collection.


The example demonstrates how to find text on the first PDF document page and replace the text and it's font.

 // Open document
 Document doc = new Document("D:\\Tests\\input.pdf");
 // Find font that will be used to change document text font
 com.aspose.pdf.Font font = FontRepository.findFont("Arial");
 // Create TextFragmentAbsorber object to find all "hello world" text occurrences
 TextFragmentAbsorber absorber = new TextFragmentAbsorber("hello world");
 // Accept the absorber for first page
 doc.getPages().get(1).accept(absorber);
 // Change text and font of the first text occurrence
 absorber.getTextFragments().get_Item(1).setText ( "hi world");
 absorber.getTextFragments().get_Item(1).getTextState().setFont ( font);
 // Save document
 doc.save("D:\\Tests\\output.pdf");

The TextFragmentAbsorber object is basically used in text search scenario. When the search is completed the occurrences are represented with TextFragment objects that the TextFragmentAbsorber.TextFragments collection contains. 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).

Constructors

ConstructorDescription
TextFragmentAbsorber()Initializes a new instance of the TextFragmentAbsorber that performs search of all text segments of the document or page.
TextFragmentAbsorber(TextEditOptions textEditOptions)Initializes a new instance of the TextFragmentAbsorber with text edit options, that performs search of all text segments of the document or page.
TextFragmentAbsorber(String phrase)Initializes a new instance of the TextFragmentAbsorber class for the specified text phrase.
TextFragmentAbsorber(Pattern regex)Initializes a new instance of the TextFragmentAbsorber class for the specified System.Text.RegularExpressions.Regex class object.
TextFragmentAbsorber(String phrase, TextSearchOptions textSearchOptions)Initializes a new instance of the TextFragmentAbsorber class for the specified text phrase and text search options.
TextFragmentAbsorber(Pattern regex, TextSearchOptions textSearchOptions)Initializes a new instance of the TextFragmentAbsorber class for the specified text phrase and text search options.
TextFragmentAbsorber(String phrase, TextSearchOptions textSearchOptions, TextEditOptions textEditOptions)Initializes a new instance of the TextFragmentAbsorber class for the specified text phrase, text search options and text edit options.
TextFragmentAbsorber(Pattern regex, TextEditOptions textEditOptions)Initializes a new instance of the TextFragmentAbsorber class for the specified text phrase and text edit options.
TextFragmentAbsorber(String phrase, TextEditOptions textEditOptions)Initializes a new instance of the TextFragmentAbsorber class for the specified text phrase and text edit options.

Methods

MethodDescription
getTextFragments()Gets collection of search occurrences that are presented with TextFragment objects.
setTextFragments(TextFragmentCollection value)Sets collection of search occurrences that are presented with TextFragment objects.
getPhrase()Gets phrase that the TextFragmentAbsorber searches on the PDF document or page.
setPhrase(String value)Sets phrase that the TextFragmentAbsorber searches on the PDF document or page.
getTextSearchOptions()Gets search options.
setTextSearchOptions(TextSearchOptions value)Sets search options.
getTextEditOptions()Gets text edit options.
setTextEditOptions(TextEditOptions value)Sets text edit options.
getTextReplaceOptions()Gets text replace options.
setTextReplaceOptions(TextReplaceOptions value)Sets text replace options.
hasErrors_Fragment()Value indicates whether errors were found during text extraction.
getErrors()List of TextExtractionError objects.
getText()Gets extracted text that the TextAbsorber extracts on the PDF document or page.
visit(Page page)Performs search on the specified page.
visit(IDocument pdf)Performs search on the specified document.
applyForAllFragments(Font font)Applies font for all text fragments that were absorbed.
applyForAllFragments(float fontSize)Applies font size for all text fragments that were absorbed.
applyForAllFragments(Font font, float fontSize)Applies font and size for all text fragments that were absorbed.
reset()Clears TextFragments collection of this TextFragmentAbsorber object.
removeAllText(Page page)Removes all text from the specified page.
removeAllText(Page page, Rectangle rect)Removes text inside the specified rectangle from the specified page.
removeAllText(Document document)Removes all text from the document.
visit(XForm xForm)Performs search on the specified form object.
getExtractionOptions()Gets text extraction options.
setExtractionOptions(TextExtractionOptions value)Sets text extraction options.

TextFragmentAbsorber()

public TextFragmentAbsorber()

Initializes a new instance of the TextFragmentAbsorber that performs search of all text segments of the document or page.


The example demonstrates how to find text on the first PDF document page and replace the text.

 // Open document
 Document doc = new Document("D:\\Tests\\input.pdf");
 // Find font that will be used to change document text font
 Font font = FontRepository.findFont("Arial");
 // Create TextFragmentAbsorber object
 TextFragmentAbsorber absorber = new TextFragmentAbsorber();
 // Make the absorber to search all "hello world" text occurrences
 absorber.setPhrase ( "hello world");
 // Accept the absorber for first page
 doc.getPages().get(1).accept(absorber);
 // Change text of the first text occurrence
 absorber.getTextFragments().get_Item(1).setText ( "hi world");
 // Save document
 doc.save("D:\\Tests\\output.pdf");

Performs text search and provides access to search results via TextFragmentAbsorber.TextFragments collection.

TextFragmentAbsorber(TextEditOptions textEditOptions)

public TextFragmentAbsorber(TextEditOptions textEditOptions)

Initializes a new instance of the TextFragmentAbsorber with text edit options, that performs search of all text segments of the document or page.


The example demonstrates how to find all text fragments on the first PDF document page and replace font for them.

  // Open document
  Document doc = new Document("D:\\Tests\\input.pdf");

  // Create TextFragmentAbsorber object
  TextFragmentAbsorber absorber = new TextFragmentAbsorber(new TextEditOptions(TextEditOptions.FontReplace
  .RemoveUnusedFonts));

  // Accept the absorber for first page
  doc.getPages()get(1).accept(absorber);

  // Find Courier font
  Font font = FontRepository.findFont("Courier");
  // Set the font for all the text fragments
  for (TextFragment textFragment : ```
(Iterable)
```absorber.TextFragments)
  {
      textFragment.getTextState().setFont ( font);
  }
  // Save document
  doc.save("D:\\Tests\\output.pdf");

Parameters:

ParameterTypeDescription
textEditOptionsTextEditOptionsText edit options (Allows to turn on some edit features).

Performs text search and provides access to search results via TextFragmentAbsorber.TextFragments collection. |

TextFragmentAbsorber(String phrase)

public TextFragmentAbsorber(String phrase)

Initializes a new instance of the TextFragmentAbsorber class for the specified text phrase.


The example demonstrates how to find text on the first PDF document page and replace the text and it's font.

 // Open document
 Document doc = new Document("D:\\Tests\\input.pdf");
 // Find font that will be used to change document text font
 com.aspose.pdf.Font font = FontRepository.findFont("Arial");
 // Create TextFragmentAbsorber object to find all "hello world" text occurrences
 TextFragmentAbsorber absorber = new TextFragmentAbsorber("hello world");
 // Accept the absorber for first page
 doc.getPages().get_Item(1).accept(absorber);
 // Change text and font of the first text occurrence
 absorber.getTextFragments().get_Item(1).setText ( "hi world");
 absorber.getTextFragments().get_Item(1).getTextState().setFont ( font);
 // Save document
 doc.save("D:\\Tests\\output.pdf");

Parameters:

ParameterTypeDescription
phrasejava.lang.StringPhrase that the TextFragmentAbsorber searches

Performs text search of the specified phrase and provides access to search results via TextFragmentAbsorber.TextFragments collection. |

TextFragmentAbsorber(Pattern regex)

public TextFragmentAbsorber(Pattern regex)

Initializes a new instance of the TextFragmentAbsorber class for the specified System.Text.RegularExpressions.Regex class object.


The example demonstrates how to find text on the first PDF document page and replace the text and it’s font.

// Open document
  Document doc = new Document("input.pdf");
  // Find font that will be used to change document text font
  Font font = FontRepository.findFont("Arial");
  // Create TextAbsorber object to find all instances of the input regex
  TextFragmentAbsorber absorber = new TextFragmentAbsorber(new Regex("h\\w*?o"));
  // Accept the absorber for first page
  doc.getPages().get_item(1).accept(absorber);
  // we should find "hello" word and replace it with "Hi"
  absorber.getTextFragments().get_item(1).setText("Hi");
  // Save document
  doc.save("output.pdf");

Parameters:

ParameterTypeDescription
regexjava.util.regex.PatternSystem.Text.RegularExpressions.Regex class object that the TextFragmentAbsorber searches

Performs text search of the specified phrase and provides access to search results via TextFragmentAbsorber.TextFragments (#getTextFragments#getTextFragments/#setTextFragments(TextFragmentCollection)#setTextFragments(TextFragmentCollection)) collection. |

TextFragmentAbsorber(String phrase, TextSearchOptions textSearchOptions)

public TextFragmentAbsorber(String phrase, TextSearchOptions textSearchOptions)

Initializes a new instance of the TextFragmentAbsorber class for the specified text phrase and text search options.


The example demonstrates how to find text with regular expression on the first PDF document page and replace
 the text.

 // Open document
 Document doc = new Document("D:\\Tests\\input.pdf");
 // Create TextFragmentAbsorber object that searches all words starting 'h' and ending 'o' using regular
 expression.
 TextFragmentAbsorber absorber = new TextFragmentAbsorber("h\\w*?o", new TextSearchOptions(true));
 // we should find "hello" word and replace it with "Hi"
 doc.getPages().get_Item(1).accept(absorber);
 absorber.getTextFragments().get_Item(1).setText ( "Hi");

 // Save document
 doc.save("D:\\Tests\\output.pdf");

Parameters:

ParameterTypeDescription
phrasejava.lang.StringPhrase that the TextFragmentAbsorber searches
textSearchOptionsTextSearchOptionsText search options (Allows to turn on some search features. For example, search with regular expression)

Performs text search of the specified phrase and provides access to search results via TextFragmentAbsorber.TextFragments collection. |

TextFragmentAbsorber(Pattern regex, TextSearchOptions textSearchOptions)

public TextFragmentAbsorber(Pattern regex, TextSearchOptions textSearchOptions)

Initializes a new instance of the TextFragmentAbsorber class for the specified text phrase and text search options.


The example demonstrates how to find text with regular expression on the first PDF document page and replace the text.

// Open document
  Document doc = new Document("input.pdf");
  // Create TextFragmentAbsorber object that searches all words starting 'h' and ending 'o' using regular expression.
  TextFragmentAbsorber absorber = new TextFragmentAbsorber(new Regex("h\\w*?o"), new TextSearchOptions(true));
  // we should find "hello" word and replace it with "Hi"
  doc.getPages().get_Item(1).accept(absorber);
  absorber.getTextFragments.get_Item(1).setText("Hi");
  // Save document
  doc.save("output.pdf");

Parameters:

ParameterTypeDescription
regexjava.util.regex.PatternRegex class object that the TextFragmentAbsorber searches
textSearchOptionsTextSearchOptionsText search options (Allows to turn on some search features.)

Performs text search of the specified phrase and provides access to search results via TextFragmentAbsorber.TextFragments (#getTextFragments#getTextFragments/#setTextFragments(TextFragmentCollection)#setTextFragments(TextFragmentCollection)) collection. |

TextFragmentAbsorber(String phrase, TextSearchOptions textSearchOptions, TextEditOptions textEditOptions)

public TextFragmentAbsorber(String phrase, TextSearchOptions textSearchOptions, TextEditOptions textEditOptions)

Initializes a new instance of the TextFragmentAbsorber class for the specified text phrase, text search options and text edit options. The text edit options are not supported yet.


The example demonstrates how to find text with regular expression on the first PDF document page and replace
 the text.

 // Open document
 Document doc = new Document("D:\\Tests\\input.pdf");
 // Create TextFragmentAbsorber object that searches all words starting 'h' and ending 'o' using regular
 expression.
 TextFragmentAbsorber absorber = new TextFragmentAbsorber("h\w*?o", new TextSearchOptions(true));
 // we should find "hello" word and replace it with "Hi"
 doc.getPages().get_item(1).accept(absorber);
 absorber.getTextFragments().get_Item(1).setText ( "Hi");
 // Save document
 doc.save("D:\\Tests\\output.pdf");

Parameters:

ParameterTypeDescription
phrasejava.lang.StringPhrase that the TextFragmentAbsorber searches
textSearchOptionsTextSearchOptionsText search options (Allows to turn on some search features. For example, search with regular expression)
textEditOptionsTextEditOptionsText edit options (Allows to turn on some edit features. For example, define special behavior when requested symbol cannot be written with font). The parameter is not supported yet.

Performs text search of the specified phrase and provides access to search results via TextFragmentAbsorber.TextFragments collection. |

TextFragmentAbsorber(Pattern regex, TextEditOptions textEditOptions)

public TextFragmentAbsorber(Pattern regex, TextEditOptions textEditOptions)

Initializes a new instance of the TextFragmentAbsorber class for the specified text phrase and text edit options.

Parameters:

ParameterTypeDescription
regexjava.util.regex.PatternSystem.Text.RegularExpressions.Regex class object that the TextFragmentAbsorber searches
textEditOptionsTextEditOptionsText edit options (Allows to turn on some edit features).

Performs text search of the specified phrase and provides access to search results via TextFragmentAbsorber.TextFragments (#getTextFragments#getTextFragments/#setTextFragments(TextFragmentCollection)#setTextFragments(TextFragmentCollection)) collection. |

TextFragmentAbsorber(String phrase, TextEditOptions textEditOptions)

public TextFragmentAbsorber(String phrase, TextEditOptions textEditOptions)

Initializes a new instance of the TextFragmentAbsorber class for the specified text phrase and text edit options.

Parameters:

ParameterTypeDescription
phrasejava.lang.StringPhrase that the TextFragmentAbsorber searches
textEditOptionsTextEditOptionsText edit options (Allows to turn on some edit features).

Performs text search of the specified phrase and provides access to search results via TextFragmentAbsorber.TextFragments collection. |

getTextFragments()

public TextFragmentCollection getTextFragments()

Gets collection of search occurrences that are presented with TextFragment objects.

Returns: TextFragmentCollection - TextFragmentCollection object


The example demonstrates how to find text on the first PDF document page and replace all search occurrences
 with new text.

 // Open document
 Document doc = new Document("D:\\Tests\\input.pdf");
 // Find font that will be used to change document text font
 Font font = FontRepository.findFont("Arial");
 // Create TextFragmentAbsorber object to find all "hello world" text occurrences
 TextFragmentAbsorber absorber = new TextFragmentAbsorber("hello world");
 // Accept the absorber for first page
 doc.getPages().get(1).accept(absorber);
 // Change text of all search occurrences
 for (TextFragment textFragment : ```
(Iterable)
```absorber.getTextFragments())
 {
     textFragment.setText ( "hi world");
 }
 // Save document
 doc.save("D:\\Tests\\output.pdf");

setTextFragments(TextFragmentCollection value)

public void setTextFragments(TextFragmentCollection value)

Sets collection of search occurrences that are presented with TextFragment objects.

Parameters:

ParameterTypeDescription
valueTextFragmentCollectionTextFragmentCollection object

The example demonstrates how to find text on the first PDF document page and replace all search
                                        occurrences with new text.

                                        // Open document
                                        Document doc = new Document("D:\\Tests\\input.pdf");
                                        // Find font that will be used to change document text font
                                        Font font = FontRepository.findFont("Arial");
                                        // Create TextFragmentAbsorber object to find all "hello world" text occurrences
                                        TextFragmentAbsorber absorber = new TextFragmentAbsorber("hello world");
                                        // Accept the absorber for first page
                                        doc.getPages().get(1).accept(absorber);
                                        // Change text of all search occurrences
                                        for (TextFragment textFragment : ```
(Iterable)
```absorber.getTextFragments())
                                        {
                                            textFragment.setText ( "hi world");
                                        }
                                        // Save document
                                        doc.save("D:\\Tests\\output.pdf");
``` |

### getPhrase() {#getPhrase--}

public String getPhrase()



Gets phrase that the  TextFragmentAbsorber  searches on the PDF document or page.

**Returns:**
java.lang.String - String value

--------------------

The example demonstrates how to perform search text several times and perform text replacements.

// Open document Document doc = new Document(“D:\Tests\input.pdf”); // Create TextFragmentAbsorber object to find all “hello” text occurrences TextFragmentAbsorber absorber = new TextFragmentAbsorber(“hello”); doc.getPages().get(1).accept(absorber); absorber.getTextFragments().get_Item(1).setText ( “Hi”); // search another word and replace it absorber.setPhrase ( “world”); doc.getPages().get(1).accept(absorber); absorber.getTextFragments().get_Item(1).setText ( “John”); // Save document doc.save(“D:\Tests\output.pdf”);

### setPhrase(String value) {#setPhrase-java.lang.String-}

public void setPhrase(String value)



Sets phrase that the  TextFragmentAbsorber  searches on the PDF document or page.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | java.lang.String | String value

--------------------

The example demonstrates how to perform search text several times and perform text replacements.

                                    // Open document
                                    Document doc = new Document("D:\\Tests\\input.pdf");
                                    // Create TextFragmentAbsorber object to find all "hello" text occurrences
                                    TextFragmentAbsorber absorber = new TextFragmentAbsorber("hello");
                                    doc.getPages().get(1).accept(absorber);
                                    absorber.getTextFragments().get_Item(1).setText ( "Hi");
                                    // search another word and replace it
                                    absorber.setPhrase ( "world");
                                    doc.getPages().get(1).accept(absorber);
                                    absorber.getTextFragments().get_Item(1).setText ( "John");
                                    // Save document
                                    doc.save("D:\\Tests\\output.pdf");

### getTextSearchOptions() {#getTextSearchOptions--}

public TextSearchOptions getTextSearchOptions()



Gets search options. The options enable search using regular expressions.

**Returns:**
[TextSearchOptions](../../com.aspose.pdf/textsearchoptions) - TextSearchOptions object

--------------------

The example demonstrates how to perform search text using regular expression.

// Open document Document doc = new Document(“D:\Tests\input.pdf”); // Create TextFragmentAbsorber object TextFragmentAbsorber absorber = new TextFragmentAbsorber(); // make the absorber to search all words starting ‘h’ and ending ‘o’ using regular expression. absorber.setPhrase ( “h\w*?o”); absorber.setTextSearchOptions ( new TextSearchOptions(true)); // we should find “hello” word and replace it with “Hi” doc.getPages().get(1).accept(absorber); absorber.getTextFragments().get_Item(1).setText ( “Hi”); // Save document doc.save(“D:\Tests\output.pdf”);

### setTextSearchOptions(TextSearchOptions value) {#setTextSearchOptions-com.aspose.pdf.TextSearchOptions-}

public void setTextSearchOptions(TextSearchOptions value)



Sets search options. The options enable search using regular expressions.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | [TextSearchOptions](../../com.aspose.pdf/textsearchoptions) | TextSearchOptions object

--------------------

The example demonstrates how to perform search text using regular expression.

                                    // Open document
                                    Document doc = new Document("D:\\Tests\\input.pdf");
                                    // Create TextFragmentAbsorber object
                                    TextFragmentAbsorber absorber = new TextFragmentAbsorber();
                                    // make the absorber to search all words starting 'h' and ending 'o' using regular expression.
                                    absorber.setPhrase ( "h\w*?o");
                                    absorber.setTextSearchOptions ( new TextSearchOptions(true));
                                    // we should find "hello" word and replace it with "Hi"
                                    doc.getPages().get(1).accept(absorber);
                                    absorber.getTextFragments().get_Item(1).setText ( "Hi");
                                    // Save document
                                    doc.save("D:\\Tests\\output.pdf");

### getTextEditOptions() {#getTextEditOptions--}

public TextEditOptions getTextEditOptions()



Gets text edit options. The options define special behavior when requested symbol cannot be written with font.

**Returns:**
[TextEditOptions](../../com.aspose.pdf/texteditoptions) - TextEditOptions object
### setTextEditOptions(TextEditOptions value) {#setTextEditOptions-com.aspose.pdf.TextEditOptions-}

public void setTextEditOptions(TextEditOptions value)



Sets text edit options. The options define special behavior when requested symbol cannot be written with font.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | [TextEditOptions](../../com.aspose.pdf/texteditoptions) | TextEditOptions object |

### getTextReplaceOptions() {#getTextReplaceOptions--}

public TextReplaceOptions getTextReplaceOptions()



Gets text replace options. The options define behavior when fragment text is replaced to more short/long.

**Returns:**
[TextReplaceOptions](../../com.aspose.pdf/textreplaceoptions) - TextReplaceOptions value
### setTextReplaceOptions(TextReplaceOptions value) {#setTextReplaceOptions-com.aspose.pdf.TextReplaceOptions-}

public void setTextReplaceOptions(TextReplaceOptions value)



Sets text replace options. The options define behavior when fragment text is replaced to more short/long.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| value | [TextReplaceOptions](../../com.aspose.pdf/textreplaceoptions) | TextReplaceOptions value |

### hasErrors_Fragment() {#hasErrors-Fragment--}

public boolean hasErrors_Fragment()



Value indicates whether errors were found during text extraction. Searching for errors will performed only if TextSearchOptions.LogTextExtractionErrors = true; And it may decrease performance.

**Returns:**
boolean - boolean value
### getErrors() {#getErrors--}

public List getErrors()



List of  TextExtractionError  objects. It contain information about errors were found during text extraction. Searching for errors will performed only if TextSearchOptions.LogTextExtractionErrors = true; And it may decrease performance.

**Returns:**
java.util.List<com.aspose.pdf.TextExtractionError> - List of TextExtractionError objects
### getText() {#getText--}

public String getText()



Gets extracted text that the  TextAbsorber  extracts on the PDF document or page.

**Returns:**
java.lang.String
### visit(Page page) {#visit-com.aspose.pdf.Page-}

public void visit(Page page)



Performs search on the specified page.

--------------------

The example demonstrates how to find text on the first PDF document page and replace the text.

// Open document Document doc = new Document(“D:\Tests\input.pdf”); // Find font that will be used to change document text font Font font = FontRepository.findFont(“Arial”); // Create TextFragmentAbsorber object to find all “hello world” text occurrences TextFragmentAbsorber absorber = new TextFragmentAbsorber(“hello world”); // Accept the absorber for first page absorber.visit(doc.getPages().get(1)); // Change text of all search occurrences for (TextFragment textFragment : ``` (Iterable)

 {
     textFragment.setText ( "hi world");
 }
 // Save document
 doc.save("D:\\Tests\\output.pdf");

Parameters:

ParameterTypeDescription
pagePagePDF document page object.

visit(IDocument pdf)

public void visit(IDocument pdf)

Performs search on the specified document.


The example demonstrates how to find text on PDF document and replace text of all search occurrences.

 // Open document
 Document doc = new Document("D:\\Tests\\input.pdf");
 // Find font that will be used to change document text font
 Font font = FontRepository.findFont("Arial");
 // Create TextFragmentAbsorber object to find all "hello world" text occurrences
 TextFragmentAbsorber absorber = new TextFragmentAbsorber("hello world");
 // Accept the absorber for first page
 absorber.visit(doc);
 // Change text of the first text occurrence
 absorber.getTextFragments().get_Item(1).setText ( "hi world");
 // Save document
 doc.save("D:\\Tests\\output.pdf");

Parameters:

ParameterTypeDescription
pdfIDocumentPDF document object.

applyForAllFragments(Font font)

public void applyForAllFragments(Font font)

Applies font for all text fragments that were absorbed. It works faster than looping through the fragments if all fragments on the page(s) were absorbed. Otherwise it works similar with looping.

Parameters:

ParameterTypeDescription
fontFontFont of the text.

applyForAllFragments(float fontSize)

public void applyForAllFragments(float fontSize)

Applies font size for all text fragments that were absorbed. It works faster than looping through the fragments if all fragments on the page(s) were absorbed. Otherwise it works similar with looping.

Parameters:

ParameterTypeDescription
fontSizefloatFont size of the text.

applyForAllFragments(Font font, float fontSize)

public void applyForAllFragments(Font font, float fontSize)

Applies font and size for all text fragments that were absorbed. It works faster than looping through the fragments if all fragments on the page(s) were absorbed. Otherwise it works similar with looping.

Parameters:

ParameterTypeDescription
fontFontFont of the text.
fontSizefloatFont size of the text.

reset()

public void reset()

Clears TextFragments collection of this TextFragmentAbsorber object.

removeAllText(Page page)

public void removeAllText(Page page)

Removes all text from the specified page.

Parameters:

ParameterTypeDescription
pagePagePDF document page object.

removeAllText(Page page, Rectangle rect)

public final void removeAllText(Page page, Rectangle rect)

Removes text inside the specified rectangle from the specified page.

Parameters:

ParameterTypeDescription
pagePagePDF document page object.
rectRectangleRectangle to remove text inside.

removeAllText(Document document)

public void removeAllText(Document document)

Removes all text from the document.

Parameters:

ParameterTypeDescription
documentDocumentPDF document object.

visit(XForm xForm)

public void visit(XForm xForm)

Performs search on the specified form object.

Parameters:

ParameterTypeDescription
xFormXFormPdf form object.

getExtractionOptions()

public TextExtractionOptions getExtractionOptions()

Gets text extraction options.

Returns: TextExtractionOptions - TextExtractionOptions object

setExtractionOptions(TextExtractionOptions value)

public void setExtractionOptions(TextExtractionOptions value)

Sets text extraction options.

Parameters:

ParameterTypeDescription
valueTextExtractionOptionsTextExtractionOptions object