BatchResult

The BatchResult object represents the outcome of converting a single source document during a batch conversion run.

It is returned by convert_batch() for each input document in the batch and contains both the conversion result and any exception raised while processing the file.

class BatchResult
input

Original document path or input value passed to the converter.

success

Boolean flag indicating whether the conversion completed without an error.

error

Exception instance raised during conversion, or None when the conversion succeeded.

output

Conversion output produced by the selected backend. This may be a Markdown string, JSON payload, or text output depending on the backend used.

Example

from pymupdf import convert_batch

results = convert_batch(
    ["sample.pdf", "sample2.pdf"],
    workers=2,
    out_dir="output",
    backend="md",
)

for item in results:
    if item.success:
        print(item.input, "converted successfully")
    else:
        print(item.input, "failed:", item.error)

See also

This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of that license. Refer to licensing information at artifex.com or contact Artifex Software Inc., 39 Mesa Street, Suite 108A, San Francisco CA 94129, United States for further information.