.. index:: 
  !DocumentReader Class

.. _id3_document_document_reader_class:

===============================================================================
DocumentReader Class
===============================================================================

Namespace: :ref:`id3.Document<reference_document>`

.. toctree::
  :hidden:

  extractFace<extract_face>
  readDocument<read_document>
  readField<read_field>
  threadCount<thread_count>


Definition
----------
.. line-block::
    Reads text field on a document using optical character recognition (OCR).

.. tab-set::

    .. tab-item:: Python
      :sync: Python

      .. code:: Python

        class DocumentReader

    .. tab-item:: Dart
      :sync: Dart

      .. code:: Dart

        class DocumentReader implements Finalizable

    .. tab-item:: C#
      :sync: C#

      .. code:: C#

        public partial class DocumentReader

    .. tab-item:: Java
      :sync: Java

      .. code:: Java

        public class DocumentReader implements AutoCloseable, Serializable

    .. tab-item:: Swift
      :sync: Swift

      .. code:: Swift

        public class DocumentReader

    .. tab-item:: C
      :sync: C

      .. code:: C

        typedef struct id3DocumentReader *ID3_DOCUMENT_READER;



Usage
-----

.. tab-set::

    .. tab-item:: Python
      :sync: Python

      .. code:: Python

        documentReaderInstance = DocumentReader()
        # ...

      **Explicit destruction**

      .. code:: Python

        # ...
        del documentReaderInstance

    .. tab-item:: Dart
      :sync: Dart

      .. code:: Dart

        final documentReaderInstance = sdk.DocumentReader();
        // ...

      **Explicit destruction**

      .. code:: Dart

        // ...
        documentReaderInstance.dispose()

    .. tab-item:: C#
      :sync: C#

      .. code:: C#

        using (var documentReaderInstance = new DocumentReader())
        {
           // ...
        }

      **Explicit destruction**

      .. code:: C#

        var documentReaderInstance = new DocumentReader()
        // ...
        documentReaderInstance.Dispose()

    .. tab-item:: Java
      :sync: Java

      .. code:: Java

        try (DocumentReader documentReaderInstance = new DocumentReader()) {
        // ...
        }

      **Explicit destruction**

      .. code:: Java

        DocumentReader documentReaderInstance = new DocumentReader();
        // ...
        documentReaderInstance.close();

    .. tab-item:: Swift
      :sync: Swift

      .. code:: Swift

        private var documentReaderInstance: DocumentReader? = nil
        documentReaderInstance = try DocumentReader()

    .. tab-item:: C
      :sync: C

      .. code:: C

        ID3_DOCUMENT_READER hDocumentReader{};
        int err = id3DocumentReader_Initialize(&hDocumentReader);
        if (err == ID3_SUCCESS) {
            // ...
            id3DocumentReader_Dispose(&hDocumentReader);
        }


Properties
----------

.. list-table:: 
  :width: 100%
  :widths: 30 5 65
  :header-rows: 1

  * - Name
    - Type
    - Description
  * - :ref:`threadCount<id3_document_document_reader_thread_count_class_member>`
    - int
    - Number of threads to use for OCR.

Methods
-------

.. list-table:: 
  :width: 100%
  :widths: 30 70
  :header-rows: 1

  * - Name
    - Description
  * - :ref:`extractFace<id3_document_document_reader_extract_face_class_method>`
    - Extracts a crop of the face in a document.
  * - :ref:`readDocument<id3_document_document_reader_read_document_class_method>`
    - Reads all the fields in a document.
  * - :ref:`readField<id3_document_document_reader_read_field_class_method>`
    - Reads a single field in a document.
