Installation
To install the Scanbot SDK module you can run the following in your root project folder
- npm
- Yarn
- Expo
npm install react-native-scanbot-sdk
yarn add react-native-scanbot-sdk
npx expo install react-native-scanbot-sdk
Additional setup
Android
Since your application will work with high-resolution images, it is strongly recommended to add the property android:largeHeap="true"
in the <application>
element of your android/app/src/main/AndroidManifest.xml
file, especially for Android <= 7.x.
Processing hi-res images is a memory intensive task and this property will ensure your app has enough heap allocated to avoid OutOfMemoryError
exceptions.
<application ... android:largeHeap="true">
...
</application>
Expo
Integration with Expo is possible only when using a development build. The project is configurable using our config plugin or manually configure the native projects. To utilize the plugin you can add the following in your app config file:
"plugins": [
[
"react-native-scanbot-sdk",
{
"iOSCameraUsageDescription": "Document & Barcode Scanning permission",
"largeHeap": true,
"mavenURLs": true,
"ocrBlobsDirPath": "./ocr_blobs"
}
]
],
iOSCameraUsageDescription
: AddsNSCameraUsageDescription
in Info.plist. The permission can also be added via Expo PermissionslargeHeap
: Addsandroid:largeHeap
property in<application>
element in AndroidManifest.xmlmavenURLs
: Adds Scanbot SDK Maven urls for Android local development. These URLs are already included in our package's build.gradle, but need to be added due to how Expo starts the Android appocrBlobsDirPath
: Addsocr_blobs
for Android and iOS. Specify a path of a directory that contains only .traineddata files.
For Android, the files are copied over from the specified path in android/app/src/main/assets/ocr_blobs.
For iOS, a ScanbotSDKOCRData.bundle
is created and added as a resource, and the files are copied over from the specified path.
See more about OCR installation
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get your free Trial LicenseWhat do you think of this documentation?
What can we do to improve it? Please be as detailed as you like.