eu.id3.document

## Class DocumentReader

- java.lang.Object
- - eu.id3.document.DocumentReader

- All Implemented Interfaces:
    java.io.Serializable, java.lang.AutoCloseable

      public class DocumentReader
      extends java.lang.Object
      implements java.lang.AutoCloseable, java.io.Serializable

  Reads text field on a document using optical character recognition (OCR).
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DocumentReader()` Creates a new instance of the DocumentReader class.
    `DocumentReader(long handle)` Creates a new instance of the DocumentReader class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Releases all resources used by this DocumentReader.
    `DocumentImage` | `extractFace(DocumentImage image, java.lang.String documentName)` Extracts a crop of the face in a document.
    `protected void` | `finalize()` Finalizer for this class.
    `long` | `getHandle()` Gets the native handle.
    `int` | `getThreadCount()` Gets the number of threads to use for OCR.
    `TextFieldList` | `readDocument(DocumentImage image, java.lang.String documentName)` Reads all the fields in a document.
    `TextField` | `readField(DocumentImage image, java.lang.String documentName, java.lang.String fieldName)` Reads a single field in a document.
    `void` | `setThreadCount(int threadCount)` Sets the number of threads to use for OCR.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DocumentReader

          public DocumentReader()
                         throws DocumentException

      Creates a new instance of the DocumentReader class.
      Throws:
        `DocumentException` - An error has occurred during Document Library execution.

    - #### DocumentReader

          public DocumentReader(long handle)
                         throws DocumentException

      Creates a new instance of the DocumentReader class.
      Parameters:
        `handle` - Handle to the DocumentReader.
      Throws:
        `DocumentException` - An error has occurred during Document Library execution.

  - ### Method Detail

    - #### close

          public void close()

      Releases all resources used by this DocumentReader.
      Specified by:
        `close` in interface `java.lang.AutoCloseable`

    - #### finalize

          protected void finalize()

      Finalizer for this class. Finalizers are deprecated since Java 9+. This method is not guaranteed to be called. To release all memory held by this class please be sure to call the close() method.
      Overrides:
        `finalize` in class `java.lang.Object`

    - #### getHandle

          public long getHandle()

      Gets the native handle.
      Returns:
        The native handle.

    - #### getThreadCount

          public int getThreadCount()
                             throws DocumentException

      Gets the number of threads to use for OCR. Hint: Default value is 1. Allocating more than 1 thread here can increase the speed of the process.
      Returns:
        Number of threads to use for OCR.
      Throws:
        `DocumentException` - An error has occurred during Document Library execution.

    - #### setThreadCount

          public void setThreadCount(int threadCount)
                              throws DocumentException

      Sets the number of threads to use for OCR. Hint: Default value is 1. Allocating more than 1 thread here can increase the speed of the process.
      Parameters:
        `threadCount` - Number of threads to use for OCR.
      Throws:
        `DocumentException` - An error has occurred during Document Library execution.

    - #### extractFace

          public DocumentImage extractFace(DocumentImage image,
                                           java.lang.String documentName)
                                    throws DocumentException

      Extracts a crop of the face in a document.
      Parameters:
        `image` - The image that contains the document. Must be a realigned BGR image of the document.
        `documentName` - The name of the document to be searched. Must be a key loaded in DocumentLibrary.
      Returns:
        The cropped image of the face.
      Throws:
        `DocumentException` - An error has occurred during Document Library execution.

    - #### readDocument

          public TextFieldList readDocument(DocumentImage image,
                                            java.lang.String documentName)
                                     throws DocumentException

      Reads all the fields in a document.
      Parameters:
        `image` - The image that contains the document. Must be a realigned BGR image of the document.
        `documentName` - The name of the document to be searched. Must be a key loaded in DocumentLibrary.
      Returns:
        A list of all the text fields read in the document.
      Throws:
        `DocumentException` - An error has occurred during Document Library execution.

    - #### readField

          public TextField readField(DocumentImage image,
                                     java.lang.String documentName,
                                     java.lang.String fieldName)
                              throws DocumentException

      Reads a single field in a document.
      Parameters:
        `image` - The image that contains the document. Must be a realigned BGR image of the document.
        `documentName` - The name of the document to be searched. Must be a key loaded in DocumentLibrary.
        `fieldName` - The name of the field to search.
      Returns:
        Read Text in the specified field.
      Throws:
        `DocumentException` - An error has occurred during Document Library execution.

Copyright © 2020-2030, id3 Technologies. All rights reserved. eu.id3.document