This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /api/python/settings/vision/advanced/ocr-settings.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. OcrSettings

Settings for Ocr. Values fall back through three levels: document → SDK → built-in default. Writes target the document only when set on a document’s settings, otherwise the SDK globally when set on SdkSettings.

Tags: Vision, Advanced

from nutrient_sdk import OcrSettings

Construction

OcrSettings is accessed through a Document instance for per-document overrides, or via SdkSettings for SDK-wide defaults.

# Per-document override
with Document.open("input.pdf") as doc:
settings = doc.settings.ocr_settings
settings.some_field = new_value # mutate fields directly
# SDK-wide default (applies to all documents)
SdkSettings.ocr_settings.some_field = new_value

Settings are configured by writing to fields on the returned object. The settings property itself cannot be reassigned — doc.settings.ocr_settings = other_settings is rejected.

Properties

default_languages

@property
def default_languages(self) -> str
@default_languages.setter
def default_languages(self, value: str) -> None

Default OCR languages to use (comma-separated language codes).

Type: str

Default: "eng"


enable_preprocessing

@property
def enable_preprocessing(self) -> bool
@enable_preprocessing.setter
def enable_preprocessing(self, value: bool) -> None

Indicates whether to enable image preprocessing before OCR.

Type: bool

Default: true


enable_skew_detection

@property
def enable_skew_detection(self) -> bool
@enable_skew_detection.setter
def enable_skew_detection(self, value: bool) -> None

Indicates whether to enable automatic skew detection and correction.

Type: bool

Default: true


enable_table_detection

@property
def enable_table_detection(self) -> bool
@enable_table_detection.setter
def enable_table_detection(self, value: bool) -> None

Indicates whether to detect and extract tables from OCR output.

Type: bool

Default: true


favor_accuracy

@property
def favor_accuracy(self) -> bool
@favor_accuracy.setter
def favor_accuracy(self, value: bool) -> None

Indicates whether to favor accuracy over speed in OCR processing.

Type: bool

Default: true


max_languages

@property
def max_languages(self) -> int
@max_languages.setter
def max_languages(self, value: int) -> None

Maximum number of languages to report from offline language detection. The default, 1, reports only the dominant language (no language mixing). Raise it (e.g. 2) to detect multiple languages in one document, including two languages that share a script (such as English + French).

Type: int

Default: 1


max_scripts

@property
def max_scripts(self) -> int
@max_scripts.setter
def max_scripts(self, value: int) -> None

Maximum number of writing scripts to recognize on a page during offline language detection (and the “auto” OCR path). The default, 1, recognizes only the dominant script (no script mixing) — fastest, and the original behavior. Raise it (e.g. 2) to handle cross-script documents such as Cyrillic + Han, where the page is OCR’d with each detected script’s model.

Type: int

Default: 1


min_language_vote_fraction

@property
def min_language_vote_fraction(self) -> float
@min_language_vote_fraction.setter
def min_language_vote_fraction(self, value: float) -> None

Consensus control for multi-language detection (only applies when MaxLanguages is greater than 1). A secondary language that is not present in the whole-page reading is reported only if the regions that detect it make up at least this fraction (0.0 to 1.0) of all regions. Works together with MinLanguageVotes to keep the extra language from being inferred from a negligible share of a long document.

Type: float

Default: 0.2


min_language_votes

@property
def min_language_votes(self) -> int
@min_language_votes.setter
def min_language_votes(self, value: int) -> None

Consensus control for multi-language detection (only applies when MaxLanguages is greater than 1). A secondary language that is not present in the whole-page reading is reported only if it is detected in at least this many text regions. Raising it improves precision — it suppresses a spurious extra language inferred from a single noisy region — at a small cost to recall of a genuine minority language that appears in only one region.

Type: int

Default: 2


min_script_ratio

@property
def min_script_ratio(self) -> float
@min_script_ratio.setter
def min_script_ratio(self, value: float) -> None

Minimum share of a page (0.0 to 1.0) a secondary writing script must occupy before the page is also read with that script’s model (only applies when MaxScripts is greater than 1). Raising it improves precision: it stops a faint, spurious script — often lookalike letters a second script’s model misreads from the dominant script — from being read at all, which is a common source of a wrongly reported extra language. The dominant script is always read.

Type: float

Default: 0.2