Java OCR SDK
Mindee API Helper Library for Java
Quickly and easily connect to Mindee's API services using Java.
Quick Start
Here's the TL;DR of getting started.
First, get an API Key
Include the following maven dependency in your project to use the helper library:
<dependency>
<artifactId>mindee-api-java</artifactId>
<groupId>com.mindee.sdk</groupId>
<version>${mindee.sdk.version}</version>
</dependency>
Where ${mindee.sdk.version}
is the version shown here:
Loading a File and Parsing It
The MindeeClient
class is the entry point for most of the helper library features.
Global Documents
These classes are available in the com.mindee.parsing
package:
import com.mindee.parsing;
import com.mindee.parsing.invoice;
MindeeClient mindeeClient = MindeeClientInit.create("my-api-key");
DocumentToParse documentToParse = mindeeClient.loadDocument(new File("/path/to/the/file.ext"));
Document<InvoiceV4Inference> invoiceDocument = mindeeClient.parse(
InvoiceV4Inference.class,
documentToParse
);
Region-Specific Documents
Each region will have its own package within the general com.mindee.parsing
package.
For example USA-specific classes will be in the com.mindee.parsing.us
package:
import com.mindee.parsing;
import com.mindee.parsing.us.bankcheck;
MindeeClient mindeeClient = MindeeClientInit.create("my-api-key");
DocumentToParse documentToParse = mindeeClient.loadDocument(new File("/path/to/the/file.ext"));
Document<BankCheckV1Inference> bankCheckDocument = mindeeClient.parse(
BankCheckV1Inference.class,
documentToParse
);
Custom Documents (API Builder)
import com.mindee.parsing;
import com.mindee.parsing.custom;
MindeeClient mindeeClient = MindeeClientInit.create("my-api-key");
CustomEndpoint customEndpoint = new CustomEndpoint("my-endpoint", "my-account");
DocumentToParse documentToParse = mindeeClient.loadDocument(
new File("src/main/resources/invoices/invoice1.pdf")
);
Document<CustomV1Inference> customDocument = mindeeClient.parse(
documentToParse,
customEndpoint
);
Client supports multiple input types:
- java.io.File file
- InputStream fileAsStream, String filename
- byte[] fileAsByteArray, String filename
- String fileAsBase64String, String filename
Further Reading
Complete details on the working of the library are available in the following guides:
- Getting started
- Output Fields
- Custom APIs (API Builder)
- Invoice API
- Receipt API
- Financial Document API
- Passport API
- License Plate API
- Shipping Container API
- US Bank Check API
You can view the source code on GitHub.
License
Copyright © Mindee
Available as open source under the terms of the MIT License.
Questions?
Updated 2 months ago