__init__ constructor

init

Initializes a new PageTextAreaOptions instance with the OCR usage option.

def __init__(self):
    ...

init

Initializes a new instance of the PageTextAreaOptions class with the OCR usage option.

def __init__(self, use_ocr):
    ...
Parameter Type Description
use_ocr bool The value that indicates whether OCR functionality is used to extract text areas.

init

Initializes a new instance of the PageTextAreaOptions class with the ability to set OCR options.

def __init__(self, use_ocr, ocr_options):
    ...
Parameter Type Description
use_ocr bool The value that indicates whether OCR functionality is used to extract text areas.
ocr_options OcrOptions The additional options for OCR functionality.

init

Initializes a new PageTextAreaOptions instance with the regular expression.

The following properties have default values:

def __init__(self, expression):
    ...
Parameter Type Description
expression str The regular expression.

Example

from groupdocs.parser.options import PageTextAreaOptions

options = PageTextAreaOptions(expression=r"\d{4}-\d{2}-\d{2}")

init

Initializes a new PageTextAreaOptions instance with the regular expression and rectangular area, leaving other options at their default values.

By default, MatchCase, UniteSegments, and IgnoreFormatting are set to False.

def __init__(self, expression, rectangle):
    ...
Parameter Type Description
expression str The regular expression.
rectangle Rectangle The rectangular area that contains page areas.

Example

from groupdocs.parser.options import PageTextAreaOptions
from groupdocs.parser.data import Rectangle, Point, Size

rect = Rectangle(Point(0, 0), Size(200, 100))
options = PageTextAreaOptions(r"\w+", rect)

init

Initializes a new instance of the PageTextAreaOptions class with the regular expression, rectangular area and the size of the ignored border.

def __init__(self, expression, rectangle, rectangle_tolerance):
    ...
Parameter Type Description
expression str The regular expression.
rectangle Rectangle The rectangular area that contains page areas.
rectangle_tolerance float The size of the border that is ignored when captured by the rectangular area. Measured as a fraction of a text item height.

Example

from groupdocs.parser.options import PageTextAreaOptions
from groupdocs.parser.data import Rectangle

options = PageTextAreaOptions(
    expression=r"\d+",
    rectangle=Rectangle(0, 0, 100, 200),
    rectangle_tolerance=0.1
)

init

Initializes a new PageTextAreaOptions instance.

def __init__(self, expression, match_case, unite_segments, ignore_formatting, rectangle):
    ...
Parameter Type Description
expression str The regular expression.
match_case bool Indicates whether text case is considered.
unite_segments bool Indicates whether segments are united.
ignore_formatting bool Indicates whether text formatting is ignored.
rectangle Rectangle The rectangular area that contains page areas.

Example

from groupdocs.parser.options import PageTextAreaOptions
from groupdocs.parser.data import Rectangle, Point, Size

# Define a rectangular region (x=0, y=0, width=200, height=100)
rect = Rectangle(Point(0, 0), Size(200, 100))

options = PageTextAreaOptions(
    expression=r"\d{4}-\d{2}-\d{2}",
    match_case=True,
    unite_segments=False,
    ignore_formatting=False,
    rectangle=rect,
)

init

Initializes a new PageTextAreaOptions instance with the size of the ignored border.

def __init__(self, expression, match_case, unite_segments, ignore_formatting, rectangle, rectangle_tolerance):
    ...
Parameter Type Description
expression str The regular expression.
match_case bool Indicates whether text case is considered.
unite_segments bool Indicates whether segments are united.
ignore_formatting bool Indicates whether text formatting is ignored.
rectangle Rectangle The rectangular area that contains page areas.
rectangle_tolerance float The size of the border that is ignored when captured by the rectangular area. Measured as a fraction of a text item height.

Example

from groupdocs.parser.options import PageTextAreaOptions
from groupdocs.parser.data import Rectangle

options = PageTextAreaOptions(
    expression=r"\d+",
    match_case=True,
    unite_segments=False,
    ignore_formatting=False,
    rectangle=Rectangle(0, 0, 100, 200),
    rectangle_tolerance=0.05,
)

See Also