.. index:: 
  !DocumentDetector.detectDocumentByName Method
  
.. _id3_document_document_detector_detect_document_by_name_class_method:

===============================================================================
DocumentDetector.detectDocumentByName Method
===============================================================================

Module: :ref:`DocumentDetector<id3_document_document_detector_class>`

Definition
----------

Detects a document with specified name on a delimited area of the specified DocumentImage and returns a DetectedDocument.

.. important:: The relevant document template must be loaded before calling this method.


.. tab-set::

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

      .. code:: Python

        detect_document_by_name(self, image: DocumentImage, document_name: str, detection_zone: Rectangle) -> DetectedDocument

      **Parameters**

        .. line-block::

          ``image`` :ref:`DocumentImage<id3_document_document_image_class>`
          :guilabel:`in` The source image to process.

          ``document_name`` str
          :guilabel:`in` The name of the document to be searched for. Must be a key loaded in DocumentLibrary.

          ``detection_zone`` :ref:`Rectangle<id3_document_rectangle_struct>`
          :guilabel:`in` A delimited area in the image where to search for the document. Default is the full image. Output corners are in the full image referential.


      **Returns**

        .. line-block::

          :ref:`DetectedDocument<id3_document_detected_document_class>`
          Detected document in the image

      **Exceptions**

        .. line-block::

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


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

      .. code:: Dart

        DetectedDocument detectDocumentByName(DocumentImage image, String? documentName, Rectangle detectionZone)

      **Parameters**

        .. line-block::

          ``image`` :ref:`DocumentImage<id3_document_document_image_class>`
          :guilabel:`in` The source image to process.

          ``documentName`` String
          :guilabel:`in` The name of the document to be searched for. Must be a key loaded in DocumentLibrary.

          ``detectionZone`` :ref:`Rectangle<id3_document_rectangle_struct>`
          :guilabel:`in` A delimited area in the image where to search for the document. Default is the full image. Output corners are in the full image referential.


      **Returns**

        .. line-block::

          :ref:`DetectedDocument<id3_document_detected_document_class>`
          Detected document in the image

      **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 DetectedDocument DetectDocumentByName(DocumentImage image, string documentName, Rectangle detectionZone)

      **Parameters**

        .. line-block::

          ``image`` :ref:`DocumentImage<id3_document_document_image_class>`
          :guilabel:`in` The source image to process.

          ``documentName`` string
          :guilabel:`in` The name of the document to be searched for. Must be a key loaded in DocumentLibrary.

          ``detectionZone`` :ref:`Rectangle<id3_document_rectangle_struct>`
          :guilabel:`in` A delimited area in the image where to search for the document. Default is the full image. Output corners are in the full image referential.


      **Returns**

        .. line-block::

          :ref:`DetectedDocument<id3_document_detected_document_class>`
          Detected document in the image

      **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 DetectedDocument detectDocumentByName(DocumentImage image, String documentName, Rectangle detectionZone) throws DocumentException

      **Parameters**

        .. line-block::

          ``image`` :ref:`DocumentImage<id3_document_document_image_class>`
          :guilabel:`in` The source image to process.

          ``documentName`` String
          :guilabel:`in` The name of the document to be searched for. Must be a key loaded in DocumentLibrary.

          ``detectionZone`` :ref:`Rectangle<id3_document_rectangle_struct>`
          :guilabel:`in` A delimited area in the image where to search for the document. Default is the full image. Output corners are in the full image referential.


      **Returns**

        .. line-block::

          :ref:`DetectedDocument<id3_document_detected_document_class>`
          Detected document in the image

      **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 func detectDocumentByName(image: DocumentImage, documentName: String, detectionZone: Rectangle) throws -> DetectedDocument

      **Parameters**

        .. line-block::

          ``image`` :ref:`DocumentImage<id3_document_document_image_class>`
          :guilabel:`in` The source image to process.

          ``documentName`` String
          :guilabel:`in` The name of the document to be searched for. Must be a key loaded in DocumentLibrary.

          ``detectionZone`` :ref:`Rectangle<id3_document_rectangle_struct>`
          :guilabel:`in` A delimited area in the image where to search for the document. Default is the full image. Output corners are in the full image referential.


      **Returns**

        .. line-block::

          :ref:`DetectedDocument<id3_document_detected_document_class>`
          Detected document in the image

      **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 id3DocumentDetector_DetectDocumentByName (
            ID3_DOCUMENT_DETECTOR hDocumentDetector, 
            ID3_DOCUMENT_IMAGE hImage, 
            const char * documentName, 
            const id3DocumentRectangle * sDetectionZone, 
            ID3_DETECTED_DOCUMENT hDetectedDocument)

      **Parameters**

        .. line-block::

          ``hDocumentDetector`` :ref:`ID3_DOCUMENT_DETECTOR<id3_document_document_detector_class>`
          :guilabel:`in` Handle to the DocumentDetector object.

          ``hImage`` :ref:`ID3_DOCUMENT_IMAGE<id3_document_document_image_class>`
          :guilabel:`in` The source image to process.

          ``documentName`` const char *
          :guilabel:`in` The name of the document to be searched for. Must be a key loaded in DocumentLibrary.

          ``sDetectionZone`` :ref:`const id3DocumentRectangle *<id3_document_rectangle_struct>`
          :guilabel:`in` A delimited area in the image where to search for the document. Default is the full image. Output corners are in the full image referential.

          ``hDetectedDocument`` :ref:`ID3_DETECTED_DOCUMENT<id3_document_detected_document_class>`
          :guilabel:`out` Detected document in the image


      **Returns**

        .. line-block::

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


