Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
Toggle table of contents sidebar

# Document reading

The DocumentReader class extracts data from ID documents. It requires as input an aligned image of a document (see Document detection for details)

Important

The document reader requires the relevant AI models to run.

## Example

The example below demonstrates how to detect a French driver’s license from an image.

Python

    # initialize the DocumentReader
    reader = id3document.DocumentReader(
        thread_count = 4
        )

    tic = time.perf_counter()
    text_fields = reader.read_document(aligned_document_image, document_name, False)
    toc = time.perf_counter()
    print(f"Document read in {1000*(toc-tic):0.1f} ms")

    print("Text fields:")
    for text_field in text_fields:
        print(f"- {text_field.name} = {text_field.value}")

## See also

- DocumentReader Class

- DetectedDocument Class