Share via


DocumentStyle Class

An object representing observed text styles.

Constructor

DocumentStyle(*args: Any, **kwargs: Any)

Variables

Name Description
is_handwritten

Is content handwritten?.

similar_font_family
str

Visually most similar font from among the set of supported font families, with fallback fonts following CSS convention (ex. 'Arial, sans-serif').

font_style

Font style. Known values are: "normal" and "italic".

font_weight

Font weight. Known values are: "normal" and "bold".

color
str

Foreground color in #rrggbb hexadecimal format.

background_color
str

Background color in #rrggbb hexadecimal format..

spans

Location of the text elements in the concatenated content the style applies to. Required.

confidence

Confidence of correctly identifying the style. Required.

Methods

as_dict

Return a dict that can be JSONify using json.dump.

clear
copy
get
items
keys
pop
popitem
setdefault
update
values

as_dict

Return a dict that can be JSONify using json.dump.

as_dict(*, exclude_readonly: bool = False) -> Dict[str, Any]

Keyword-Only Parameters

Name Description
exclude_readonly

Whether to remove the readonly properties.

Default value: False

Returns

Type Description

A dict JSON compatible object

clear

clear() -> None

copy

copy() -> Model

get

get(key: str, default: Any = None) -> Any

Parameters

Name Description
key
Required
default
Default value: None

items

items() -> ItemsView[str, Any]

keys

keys() -> KeysView[str]

pop

pop(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

popitem

popitem() -> Tuple[str, Any]

setdefault

setdefault(key: str, default: ~typing.Any = <object object>) -> Any

Parameters

Name Description
key
Required
default

update

update(*args: Any, **kwargs: Any) -> None

values

values() -> ValuesView[Any]

Attributes

background_color

Background color in #rrggbb hexadecimal format..

background_color: str | None

color

Foreground color in #rrggbb hexadecimal format.

color: str | None

confidence

Confidence of correctly identifying the style. Required.

confidence: float

font_style

"normal" and "italic".

font_style: str | _models.FontStyle | None

font_weight

"normal" and "bold".

font_weight: str | _models.FontWeight | None

is_handwritten

Is content handwritten?.

is_handwritten: bool | None

similar_font_family

Visually most similar font from among the set of supported font families, with fallback fonts following CSS convention (ex. 'Arial, sans-serif').

similar_font_family: str | None

spans

Location of the text elements in the concatenated content the style applies to. Required.

spans: List[_models.DocumentSpan]