Fromdocs is a library that allows extracting identification data from digital copies of some identification documents emited in Mozambique. The extracted data can be used to automate the completion of electronic forms and, with that the process becomes faster and less error prone.
Currently the set of documents supported by FromDocs include ID, NUIT, Passport and Driving license. The copies can be presented in PDF, JPG or PNG file formats.
In order to use this library you should first import DocumentReader class from its package, you can proceed as instructed in the following snippet:
import com.eltonlaice.DocumentReader;
Then you should create a DocumentReader instance passing a copy of the document and its type as arguments:
DocumentReader reader = new DocumentReader("/path/docfile.pdf", DocumentType.BI);
Finally you can extract data from the document like this:
Document document = reader.getDocument();
String number = document.getNumber();
String lastName = document.getLastName();
String givenNames = document.getGivenNames();
LocalDate birthdate = document.getBirthdate();
String placeBirth = document.getPlaceBirth();
LocalDate dateIssue = document.getDateIssue();
Before you install FromDocs you must make sure you have Tesseract-OCR installed in your Operating System. Feel free to browse their documentation page in order to have installation instructions.
In order to install FromDocs using Maven you have to update your project's POM.xml to include the following snippet:
<dependency>
<groupId>com.eltonlaice.fromdocs</groupId>
<artifactId>fromdocs</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
If for some reason you can't use a dependency manager like Maven or Gradle, you can download a JAR from releases page and include it in classpath of your project.
Copyright 2020 Elton Laice
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.