Class ExtractedTextFormatter.Builder
- Enclosing class:
ExtractedTextFormatter
Builder
class is a nested static class of
ExtractedTextFormatter
designed to facilitate the creation and
customization of instances of ExtractedTextFormatter
.
It allows for a step-by-step, fluent construction of the
ExtractedTextFormatter
, by providing methods to set specific configurations
such as left alignment of text, the number of top lines or bottom lines to delete,
and the number of top pages to skip before deletion. Each configuration method in
the builder returns the builder instance itself, enabling method chaining.
- Left alignment to
false
- Number of top pages to skip before deletion to 0
- Number of top text lines to delete to 0
- Number of bottom text lines to delete to 0
After configuring the builder, calling the build()
method will return a
new instance of ExtractedTextFormatter
with the specified configurations.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Constructs and returns an instance ofExtractedTextFormatter
using the configurations set on this builder.withLeftAlignment
(boolean leftAlignment) Align the document text to the left.withNumberOfBottomTextLinesToDelete
(int numberOfBottomTextLinesToDelete) Remove the bottom N lines from the page text.withNumberOfTopPagesToSkipBeforeDelete
(int numberOfTopPagesToSkipBeforeDelete) Withdraw the top N pages from the text top/bottom line deletion.withNumberOfTopTextLinesToDelete
(int numberOfTopTextLinesToDelete) Remove the top N lines from the page text.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withLeftAlignment
Align the document text to the left. Defaults to false.- Parameters:
leftAlignment
- Flag to align the text to the left.- Returns:
- this builder
-
withNumberOfTopPagesToSkipBeforeDelete
public ExtractedTextFormatter.Builder withNumberOfTopPagesToSkipBeforeDelete(int numberOfTopPagesToSkipBeforeDelete) Withdraw the top N pages from the text top/bottom line deletion. Defaults to 0.- Parameters:
numberOfTopPagesToSkipBeforeDelete
- Number of pages to skip from top/bottom line deletion policy.- Returns:
- this builder
-
withNumberOfTopTextLinesToDelete
public ExtractedTextFormatter.Builder withNumberOfTopTextLinesToDelete(int numberOfTopTextLinesToDelete) Remove the top N lines from the page text. Defaults to 0.- Parameters:
numberOfTopTextLinesToDelete
- Number of top text lines to delete.- Returns:
- this builder
-
withNumberOfBottomTextLinesToDelete
public ExtractedTextFormatter.Builder withNumberOfBottomTextLinesToDelete(int numberOfBottomTextLinesToDelete) Remove the bottom N lines from the page text. Defaults to 0.- Parameters:
numberOfBottomTextLinesToDelete
- Number of bottom text lines to delete.- Returns:
- this builder
-
build
Constructs and returns an instance ofExtractedTextFormatter
using the configurations set on this builder.This method uses the values set on the builder to initialize the configuration for the
ExtractedTextFormatter
instance. If no values are explicitly set on the builder, the defaults specified in the builder are used.It's recommended to use this method only once per builder instance to ensure that each
ExtractedTextFormatter
object is configured as intended.- Returns:
- a new instance of
ExtractedTextFormatter
configured with the values set on this builder.
-