DocumentStyle Class

An object representing observed text styles.

New in version 2023-07-31: The similar_font_family, font_style, font_weight, color, and background_color properties.

Inheritance
builtins.object
DocumentStyle

Constructor

DocumentStyle(**kwargs: Any)

Methods

from_dict

Converts a dict in the shape of a DocumentStyle to the model itself.

to_dict

Returns a dict representation of DocumentStyle.

from_dict

Converts a dict in the shape of a DocumentStyle to the model itself.

from_dict(data: Dict) -> DocumentStyle

Parameters

Name Description
data
Required

A dictionary in the shape of DocumentStyle.

Returns

Type Description

DocumentStyle

to_dict

Returns a dict representation of DocumentStyle.

to_dict() -> Dict

Returns

Type Description

dict

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.

confidence: float

font_style

"normal", "italic".

font_style: str | None

font_weight

"normal", "bold".

font_weight: str | None

is_handwritten

Indicates if the content is 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.

spans: List[DocumentSpan]