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.product
package:
import com.mindee.MindeeClient;
import com.mindee.input.LocalInputSource;
import com.mindee.parsing.common.PredictResponse;
import com.mindee.product.invoice.InvoiceV4;
import java.io.File;
import java.io.IOException;
public class SimpleMindeeClient {
public static void main(String[] args) throws IOException {
// Init a new client
MindeeClient mindeeClient = new MindeeClient("my-api-key");
// Load a file from disk
LocalInputSource localInputSource = new LocalInputSource(
new File("/path/to/the/file.ext")
);
// Parse the file
Document<InvoiceV4> response = mindeeClient.parse(
InvoiceV4.class,
localInputSource
);
// Print a summary of the parsed data
System.out.println(response.getDocument().toString());
}
}
Region-Specific Documents
Each region will have its own package within the general com.mindee.product
package.
For example USA-specific classes will be in the com.mindee.product.us
package:
import com.mindee.MindeeClient;
import com.mindee.input.LocalInputSource;
import com.mindee.parsing.common.PredictResponse;
import com.mindee.product.us.bankcheck.BankCheckV1;
import java.io.File;
import java.io.IOException;
public class SimpleMindeeClient {
public static void main(String[] args) throws IOException {
// Init a new client
MindeeClient mindeeClient = new MindeeClient("my-api-key");
// Load a file from disk
LocalInputSource localInputSource = new LocalInputSource(
new File("/path/to/the/file.ext")
);
// Parse the file
Document<BankCheckV1> response = mindeeClient.parse(
BankCheckV1.class,
localInputSource
);
// Print a summary of the parsed data
System.out.println(response.getDocument().toString());
}
}
Custom Documents (API Builder)
import com.mindee.MindeeClient;
import com.mindee.input.LocalInputSource;
import com.mindee.parsing.common.PredictResponse;
import com.mindee.product.custom.CustomV1;
import com.mindee.http.Endpoint;
import java.io.File;
import java.io.IOException;
public class SimpleMindeeClient {
public static void main(String[] args) throws IOException {
// Init a new client
MindeeClient mindeeClient = new MindeeClient("my-api-key");
// Init the endpoint for the custom document
Endpoint endpoint = new Endpoint("my-endpoint", "my-account");
// Load a file from disk
LocalInputSource localInputSource = new LocalInputSource(
new File("src/main/resources/invoices/invoice1.pdf")
);
// Parse the file
Document<CustomV1> customDocument = mindeeClient.parse(
localInputSource,
endpoint
);
}
}
Further Reading
Complete details on the working of the library are available in the following guides:
- Java Library: Overview
- Java Library: 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.
You can also take a look at the
Reference Documentation.
License
Copyright © Mindee
Available as open source under the terms of the MIT License.
Questions?
Updated 27 days ago