Skip to main content

ConvertOptions

Struct ConvertOptions 

Source
pub struct ConvertOptions {
Show 56 fields pub strict: Option<bool>, pub compact_tables: Option<bool>, pub page_break_placeholder: Option<String>, pub fetch_images: Option<bool>, pub image_sources: Option<String>, pub image_hosts: Option<Vec<String>>, pub max_image_bytes: Option<u64>, pub max_images: Option<usize>, pub max_image_total_mb: Option<u64>, pub min_image_bytes: Option<u64>, pub list_attachments: Option<bool>, pub skip_empty_cells: Option<bool>, pub ebcdic_layout: Option<String>, pub encoding: Option<String>, pub use_web_browser: Option<bool>, pub xbrl_taxonomy: Option<String>, pub asr_model: Option<String>, pub asr_lang: Option<String>, pub video_frames: Option<usize>, pub video_scene_threshold: Option<f32>, pub video_frame_max_side: Option<u32>, pub video_frame_dedupe: Option<u32>, pub pages: Option<String>, pub document_timeout: Option<f64>, pub text_layer_only: Option<bool>, pub no_ocr: Option<bool>, pub skip_ocr: Option<bool>, pub password: Option<String>, pub force_full_page_ocr: Option<bool>, pub no_table_former: Option<bool>, pub no_text_panels: Option<bool>, pub heading_hierarchy: Option<bool>, pub ocr_engine: Option<String>, pub ocr_lang: Option<String>, pub ocr_mode: Option<String>, pub ocr_scale: Option<f32>, pub images_scale: Option<f32>, pub page_images: Option<bool>, pub do_picture_classification: Option<bool>, pub do_code_enrichment: Option<bool>, pub do_formula_enrichment: Option<bool>, pub do_picture_ocr: Option<bool>, pub picture_ocr_classes: Option<String>, pub picture_ocr_min_side: Option<u32>, pub keep_picture_images: Option<bool>, pub redact_pii: Option<bool>, pub redact_mode: Option<String>, pub redact_kinds: Option<String>, pub redact_pattern: Option<String>, pub redact_images: Option<String>, pub pipeline: Option<String>, pub vlm_endpoint: Option<String>, pub vlm_model: Option<String>, pub vlm_api_key: Option<String>, pub vlm_prompt: Option<String>, pub vlm_max_tokens: Option<usize>,
}
Expand description

Conversion options as every surface accepts them — see the module docs. None everywhere is the engine’s defaults.

Fields§

§strict: Option<bool>

Cleaner, more conformant Markdown (DocumentConverter::strict).

§compact_tables: Option<bool>

Compact | a | b | Markdown tables instead of width padding (#271).

§page_break_placeholder: Option<String>

Text inserted between pages in the Markdown export (docling-core’s MarkdownParams.page_break_placeholder); docling-serve’s historical spelling md_page_break_placeholder is accepted as an alias.

§fetch_images: Option<bool>

Resolve external <img src> for HTML/EPUB/MHTML/JATS (network access) — the pre-#646 switch: true is image_sources=remote, false is none; an explicit image_sources wins.

§image_sources: Option<String>

Which image references resolve (#646): none (default — every picture a placeholder) | embedded (data: URIs and parts of the same container: EPUB/MHTML entries, email cid: attachments; no filesystem or network) | local (plus files under the source file’s directory) | remote (plus http(s) fetches). HTML, EPUB, MHTML, JATS, AsciiDoc, ODF, Markdown and email bodies.

§image_hosts: Option<Vec<String>>

Hosts a remote image fetch may reach (#646): exact names or *.suffix wildcards, a list or a comma-separated string; unset = any host. A redirect is held to the same list.

§max_image_bytes: Option<u64>

Largest image that resolves, in bytes (#646; 32 MiB, DOCLING_RS_MAX_IMAGE_BYTES).

§max_images: Option<usize>

How many images resolve per document; the rest stay placeholders (#646; unlimited, DOCLING_RS_MAX_IMAGES).

§max_image_total_mb: Option<u64>

Total resolved image bytes per document, in MiB (#646; unlimited, DOCLING_RS_MAX_IMAGE_TOTAL_MB).

§min_image_bytes: Option<u64>

Smallest image that resolves, in bytes — skips spacer / tracking pixels (#646; 0, DOCLING_RS_MIN_IMAGE_BYTES).

§list_attachments: Option<bool>

Email (.eml/.msg): append an Attachments section (#251).

§skip_empty_cells: Option<bool>

Omit empty cells from sparse XLSX/XLS table grids (#271).

§ebcdic_layout: Option<String>

EBCDIC copybook layout (#252): inline JSON or a file path.

§encoding: Option<String>

Character encoding of text inputs (a WHATWG label); unset = detect.

§use_web_browser: Option<bool>

Pre-render HTML with a headless browser (the web-browser feature).

§xbrl_taxonomy: Option<String>

XBRL: the directory the instance’s taxonomy is read from.

§asr_model: Option<String>

ASR preset (whisper_*, parakeet_tdt_0.6b_v3); unset = Whisper tiny.

§asr_lang: Option<String>

Transcription language (a Whisper code) or auto.

§video_frames: Option<usize>

Max frames sampled from a video (0 = transcript only); unset = crate::DEFAULT_VIDEO_FRAMES. "all" — or any count at or above u32::MAX — is crate::ALL_VIDEO_FRAMES: every distinct cut (#647).

§video_scene_threshold: Option<f32>

ffmpeg’s scene score (0–1) a video frame must exceed to be a cut (#647); unset = 0.27 (DOCLING_RS_VIDEO_SCENE_THRESHOLD).

§video_frame_max_side: Option<u32>

Cap on a sampled video frame’s longer side in px, applied inside ffmpeg (#647); 0 / unset = the source resolution (DOCLING_RS_VIDEO_FRAME_MAX_SIDE).

§video_frame_dedupe: Option<u32>

Hamming distance (0–64) of the difference hash under which a sampled frame is a duplicate of a kept one and dropped (#647); unset = keep every frame (DOCLING_RS_VIDEO_FRAME_DEDUPE).

§pages: Option<String>

PDF page window, "A-B" or a single "N" (1-based inclusive, #80).

§document_timeout: Option<f64>

Per-document budget in seconds for the PDF pipeline (#497).

§text_layer_only: Option<bool>

Skip the whole ML stack: text layer only (#611; no_ocr before 2.0).

§no_ocr: Option<bool>

Keep layout + TableFormer, never run OCR — docling’s do_ocr=False, its CLI’s --no-ocr (#611).

§skip_ocr: Option<bool>

no_ocr under its pre-2.0 name (#244), still read: either one set skips OCR (Self::ocr_disabled). A field of its own rather than a serde alias, so a body that sends both spellings (a pre-2.0 form) is not a duplicate-field error.

§password: Option<String>

The password of an encrypted PDF or Office document (#611, #625). pdf_password, docling’s PDF-only name (--pdf-password), is read as an alias.

§force_full_page_ocr: Option<bool>

OCR every page, discarding the text layer.

§no_table_former: Option<bool>

Skip TableFormer (geometric tables instead).

§no_text_panels: Option<bool>

Disable the text-panel heuristic (#173).

§heading_hierarchy: Option<bool>

Infer heading levels after assembly (#302).

§ocr_engine: Option<String>

ppocr (default) | tesseract (#460).

§ocr_lang: Option<String>

OCR language: en | ch or a BCP-47 tag under PP-OCR, tessdata stems or BCP-47 tags under Tesseract.

§ocr_mode: Option<String>

docling’s OcrMode (#254): default | full_page | layout_regions | pdf_aware_layout_regions.

§ocr_scale: Option<f32>

OCR input scale in px per PDF point (#254); unset = the 2.0 render.

§images_scale: Option<f32>

Picture-crop / page-image scale in px per point, 0.1–4.0 (#520).

§page_images: Option<bool>

Keep each page’s render as the JSON page image (docling’s generate_page_images, #520 — accepted as an alias).

§do_picture_classification: Option<bool>

Enrichment: classify pictures with DocumentFigureClassifier (#423).

§do_code_enrichment: Option<bool>

Enrichment: rewrite code blocks with CodeFormulaV2 (#423).

§do_formula_enrichment: Option<bool>

Enrichment: decode display formulas to LaTeX with CodeFormulaV2 (#423).

§do_picture_ocr: Option<bool>

Enrichment: OCR the embedded pictures of non-PDF documents (#645); the text becomes the picture’s description annotation.

§picture_ocr_classes: Option<String>

Comma-separated DocumentFigureClassifier labels a picture must be classified as to be OCR’d (#645); unset/empty = every picture.

§picture_ocr_min_side: Option<u32>

Smallest side in px a picture must have to be OCR’d (#645; default 32, DOCLING_RS_PICTURE_OCR_MIN_SIDE).

§keep_picture_images: Option<bool>

Keep the embedded image bytes on the pictures (#645); false drops them after the enrichment pass. Default true.

§redact_pii: Option<bool>

Redact personal data from the converted document before any export.

§redact_mode: Option<String>

What a span becomes: label (default) | pseudonym | fixed:<text>.

§redact_kinds: Option<String>

Comma-separated kinds to redact (email,phone,credit_card,iban, ip_address,url_credentials,national_id,person,organization, location,address); unset = every kind.

§redact_pattern: Option<String>

Extra patterns, NAME=REGEX entries separated by newlines (the CLI flag repeats); the match (or capture group 1) is redacted as [NAME].

§redact_images: Option<String>

Embedded images and page renders: drop (default) | box_out | keep.

§pipeline: Option<String>

standard (default) | vlm (#77): the remote vision model instead of the local ML stack. The vlm_* options are inert under standard.

§vlm_endpoint: Option<String>

VLM endpoint; falls back to DOCLING_RS_VLM_ENDPOINT.

§vlm_model: Option<String>

VLM model name; falls back to DOCLING_RS_VLM_MODEL.

§vlm_api_key: Option<String>

Bearer token for the endpoint; falls back to DOCLING_RS_VLM_API_KEY.

§vlm_prompt: Option<String>

Per-page instruction; falls back to DOCLING_RS_VLM_PROMPT.

§vlm_max_tokens: Option<usize>

max_tokens per completion (default 8192); 0 is rejected.

Implementations§

Source§

impl ConvertOptions

Source

pub fn image_sources(&self) -> Result<Option<ImageSources>, OptionsError>

The image tier image_sources names (#646); None when unset (the fetch_images alias, else the converter’s default, decides).

Source

pub fn field_names() -> Vec<String>

The wire names of every field, from the struct itself (an unset option serializes as null), so a new field is listed without a hand-kept list — the inventory test and the unknown-key checks of the JSON surfaces read it.

Source

pub fn unknown_keys<'a>( keys: impl IntoIterator<Item = &'a str>, also_known: &[&str], ) -> Vec<String>

The keys among keys that are neither a field, one of its aliases, nor in also_known — what a JSON surface that rejects typos (the C ABI, the wasm module) reports.

Source

pub fn merge_over(self, base: ConvertOptions) -> ConvertOptions

self on top of base — see merge_options.

Source

pub fn validate(&self) -> Result<(), OptionsError>

Check every option that can be checked without the input document — the one set of rules all surfaces apply, before any work starts: pages spelling, a positive document_timeout, a positive ocr_scale, images_scale in 0.1–4.0, a known pipeline, a positive vlm_max_tokens, and (with the pdf feature, which has the engine tables) a known ocr_engine / ocr_mode, an ocr_lang the selected engine reads and picture_ocr_classes the classifier predicts. asr_lang, encoding and ebcdic_layout are checked against the model / codec / copybook when the conversion runs.

Source

pub fn picture_ocr_classes(&self) -> Result<Vec<String>, OptionsError>

The parsed picture_ocr_classes (#645): the comma-separated labels, trimmed and lower-cased, empty when unset. With the pdf feature (which has the classifier’s label table) a label the DocumentFigureClassifier never predicts is rejected — a typo would otherwise silently skip every picture.

Source

pub fn redaction(&self) -> Result<Option<RedactionOptions>, OptionsError>

The parsed PII redaction request (#621): None unless redact_pii is set; the mode, kinds, patterns and image mode checked — an unknown spelling or an invalid regex is rejected here, naming the field, rather than failing the conversion.

Source

pub fn apply( &self, c: DocumentConverter, ) -> Result<DocumentConverter, OptionsError>

Validate, then set every given option on base — unset ones leave the base’s values (so a surface may pre-configure defaults of its own, e.g. docling-serve’s --strict). DocumentConverter::from_options is this on a fresh converter.

Source

pub fn page_range(&self) -> Result<Option<(usize, usize)>, OptionsError>

pages parsed (crate::parse_page_range); None when unset.

Source

pub fn document_timeout(&self) -> Result<Option<Duration>, OptionsError>

document_timeout as a duration; None when unset.

Source

pub fn pipeline(&self) -> Result<PipelineKind, OptionsError>

The pipeline the options select.

Source

pub fn enrichments(&self) -> EnrichmentOptions

The enrichment passes (#423) — unset and false both mean off.

Source

pub fn ocr_engine(&self) -> Result<Option<OcrEngine>, OptionsError>

ocr_engine parsed; None when unset (the process default applies).

Source

pub fn effective_ocr_engine(&self) -> Result<OcrEngine, OptionsError>

The engine ocr_lang is read against: ocr_engine, else the process default (DOCLING_RS_OCR_ENGINE, else PP-OCR).

Source

pub fn ocr_lang(&self) -> Result<Option<OcrLang>, OptionsError>

ocr_lang validated against the engine (#460) and, under PP-OCR, the recognition model it selects; None when unset or under Tesseract (whose language list is Self::tesseract_lang).

Source

pub fn tesseract_lang(&self) -> Result<Option<String>, OptionsError>

Tesseract’s -l argument from ocr_lang (#460); None under PP-OCR or without a language.

Source

pub fn ocr_disabled(&self) -> bool

Whether OCR is off: no_ocr or its pre-2.0 name skip_ocr (#611). What a surface that builds the PDF pipeline itself reads.

Source

pub fn ocr_mode(&self) -> Result<Option<OcrMode>, OptionsError>

ocr_mode parsed (#254); None when unset.

Source

pub fn image_output(&self) -> ImageOutput

Picture-crop scale and page images for the pipeline (#519/#520).

Source

pub fn vlm_options(&self) -> Result<Option<VlmOptions>, OptionsError>

The remote-VLM configuration (#77) when pipeline is vlm, resolved against the DOCLING_RS_VLM_* environment the way every surface did on its own before: endpoint and model from the options else the env (blank counts as unset), the prompt and API key likewise, pages composing like it does with the ML pipeline. None under the standard pipeline — the vlm_* options are then ignored, not rejected (the bindings’ long-standing contract).

Trait Implementations§

Source§

impl Clone for ConvertOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConvertOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConvertOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ConvertOptions

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ConvertOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ConvertOptions

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ConvertOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V