.. index:: 
  !MrzHelper.decode Method
  
.. _id3_document_mrz_helper_decode_class_method:

===============================================================================
MrzHelper.decode Method
===============================================================================

Module: :ref:`MrzHelper<id3_document_mrz_helper_class>`

Definition
----------

Decodes an MRZ of a given type and returns the values of the various fields.


.. tab-set::

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

      .. code:: Python

        @staticmethod
        decode(text: str, type: MrzType) -> StringDict

      **Parameters**

        .. line-block::

          ``text`` str
          :guilabel:`in` The input MRZ.

          ``type`` :ref:`MrzType<id3_document_mrz_type_enum>`
          :guilabel:`in` The input MRZ type according to ICAO-9303 standard.


      **Returns**

        .. line-block::

          :ref:`StringDict<id3_document_string_dict_class>`
          A dictionary containing the fields and values decoded in the MRZ.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


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

      .. code:: Dart

        static StringDict decode(String? text, MrzType type)

      **Parameters**

        .. line-block::

          ``text`` String
          :guilabel:`in` The input MRZ.

          ``type`` :ref:`MrzType<id3_document_mrz_type_enum>`
          :guilabel:`in` The input MRZ type according to ICAO-9303 standard.


      **Returns**

        .. line-block::

          :ref:`StringDict<id3_document_string_dict_class>`
          A dictionary containing the fields and values decoded in the MRZ.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


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

      .. code:: C#

        public static StringDict Decode(string text, MrzType type)

      **Parameters**

        .. line-block::

          ``text`` string
          :guilabel:`in` The input MRZ.

          ``type`` :ref:`MrzType<id3_document_mrz_type_enum>`
          :guilabel:`in` The input MRZ type according to ICAO-9303 standard.


      **Returns**

        .. line-block::

          :ref:`StringDict<id3_document_string_dict_class>`
          A dictionary containing the fields and values decoded in the MRZ.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


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

      .. code:: Java

        public static StringDict decode(String text, MrzType type) throws DocumentException

      **Parameters**

        .. line-block::

          ``text`` String
          :guilabel:`in` The input MRZ.

          ``type`` :ref:`MrzType<id3_document_mrz_type_enum>`
          :guilabel:`in` The input MRZ type according to ICAO-9303 standard.


      **Returns**

        .. line-block::

          :ref:`StringDict<id3_document_string_dict_class>`
          A dictionary containing the fields and values decoded in the MRZ.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


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

      .. code:: Swift

        public static func decode(text: String, type: MrzType) throws -> StringDict

      **Parameters**

        .. line-block::

          ``text`` String
          :guilabel:`in` The input MRZ.

          ``type`` :ref:`MrzType<id3_document_mrz_type_enum>`
          :guilabel:`in` The input MRZ type according to ICAO-9303 standard.


      **Returns**

        .. line-block::

          :ref:`StringDict<id3_document_string_dict_class>`
          A dictionary containing the fields and values decoded in the MRZ.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


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

      .. code:: C

        int id3DocumentMrzHelper_Decode (
            const char * text, 
            id3DocumentMrzType eType, 
            ID3_DOCUMENT_STRING_DICT hFields)

      **Parameters**

        .. line-block::

          ``text`` const char *
          :guilabel:`in` The input MRZ.

          ``eType`` :ref:`id3DocumentMrzType<id3_document_mrz_type_enum>`
          :guilabel:`in` The input MRZ type according to ICAO-9303 standard.

          ``hFields`` :ref:`ID3_DOCUMENT_STRING_DICT<id3_document_string_dict_class>`
          :guilabel:`out` A dictionary containing the fields and values decoded in the MRZ.


      **Returns**

        .. line-block::

          ``int``
          An error code.
          See :ref:`id3DocumentError<id3_document_document_error_enum>` file for the list of possible error codes.


