QuickCapture SDK by Extrieve Mobile Document Scanning SDK for Business Applications
Mobile document capturing has increased due to digitization. This has led to new challenges, such as quality and infrastructure. Due to poor capture quality, a substantial number of documents must be recaptured. This increases staffing needs and decreases customer satisfaction. IT teams must also address increased network and storage demand. The Extrieve QuickCapture SDK addresses these difficulties. Quick Capture is a developer-friendly, ready-to-use SDK with document scanning features which require minimal change to existing applications.
Extrieve Quick Capture SDK can be easily integrated into mobile or web applications, enabling them to use the camera on their mobile device as a dependable method of document scanning or capture. Optimized focus control ensure the capture of high-quality documents. Compression and conversion features help reduce the size of documents, which results in quicker uploads and infrastructure savings.
This section will explain technical information regarding SDK. Mainly the SDK will expose two classes and two supporting classes.
- ImgHelper - Purpose of this class is to handle all imaging related operations
- CameraHelper - Handle the camera related operations. Basically, an activity.
- CameraSupport - Holds various configurations for camera.
- ImgException - Handle all exceptions on Image related operations on ImgHelper.
Based on the requirement any one or all classes can be used. And need to import those from the SDK.
import com.extrieve.quickcapture.sdk.ImgHelper;
import com.extrieve.quickcapture.sdk.CameraHelper;
import com.extrieve.quickcapture.sdk.CameraSupport; import com.extrieve.quickcapture.sdk.ImgException;
This class will be implemented as an activity. This class can be initialized as intent.
Intent CameraIntent = new Intent(this,Class._forName_("com.extrieve.quickcapture.sdk.CameraHelper")); UriphotoURI=Uri._parse_(CameraSupport.CamConfigClass._OutputPath_); getActivity().grantUriPermission(this.getPackageName(), photoURI, Intent._FLAG_GRANT_WRITE_URI_PERMISSION_ | Intent._FLAG_GRANT_READ_URI_PERMISSION_); if (Build.VERSION._SDK_INT_ <= Build.VERSION_CODES._LOLLIPOP_) { CameraIntent.addFlags(Intent._FLAG_GRANT_WRITE_URI_PERMISSION_); } startActivityForResult(CameraIntent,REQUEST_CODE_FILE_RETURN);
And result of cameraHelper activity can be collected as:
@Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE_FILE_RETURN && resultCode == Activity._RESULT_OK_){ Boolean Status = (Boolean) data.getExtras().get("STATUS"); String Description = (String) data.getExtras().get("DESCRIPTION"); if(Status == false){ //Failed to capture finishActivity(REQUEST_CODE_FILE_RETURN); return; } FileCollection = (ArrayList<String>) data.getExtras().get("fileCollection"); //FileCollection //: will contains all capture images path as string finishActivity(REQUEST_CODE_FILE_RETURN); }
Camera Helper having a supporting class with static configuration
CameraSupport.CamConfigClass.** CamConfigClass :**contains various configurations as follows:
-
OutputPath - To set the output directory in which the captured images will be saved. Base app should have rights to write to the provided path. CameraSupport.CamConfigClass.OutputPath = "pass output path as string";
-
MaxPage - To set the number of captures to do on each camera session. And this can also control whether the capture mode is single or multi i.e.., CameraSupport.CamConfigClass.MaxPage = 0;
- MaxPage <= 0 : Unlimited Capture Mode
- MaxPage = 1 : Limited Single Capture
- MaxPage > 1 : Limited Multi Capture Mode
-
ColorMode - To Set the capture color mode- supporting color and grayscale. CameraSupport.CamConfigClass.ColorMode = 1; //1-RGB,2-GRAY
-
CaptureReview - To Enable review for a capture session. CameraSupport.CamConfigClass.CaptureReview = true/false;
-
DeviceInfo - Will share all general information about the device. CameraSupport.CamConfigClass.DeviceInfo;
-
LastLogInfo - Will share all error details from CameraHelper.Will contains the last caught errors from camera helper section. CameraSupport.CamConfigClass.LastLogInfo;
-
CaptureSound - To Enable camera capture sound. CameraSupport.CamConfigClass.CaptureSound = true;
-
UseDefaultCamera - Can Manually set the native camera for any camera2 API failed devices CameraSupport.CamConfigClass.UseDefaultCamera = true;
-
ShowCaptureCountAndLimit - Can enable/disable capture limit toast/message & captured number CameraSupport.CamConfigClass.ShowCaptureCountAndLimit = true;
-
EnableFlash - Enable Document capture specific flash control for SDK camera. CameraSupport.CamConfigClass.EnableFlash = true;
-
SDKInfo - Contains all version related information on SDK. CameraSupport.CamConfigClass.SDKInfo;
-
CameraToggle - Toggle camera between front and back. CameraSupport.CamConfigClass.CameraToggle = 2;
- 0-Disable camera toggle option
- 1-Enable camera toggle option with Front camera by default
- 2-Enable camera toggle option with Back camera by default -
EnableTouchToFocus - To enable touch to focus. CameraSupport.CamConfigClass.EnableTouchToFocus = true; - true - Enable | false - Disable.
CameraHelper class will be further optimized as part of the testing and development. Also there will be additional parameter options as well as license initialization as part of the SDK initialization process.
Following are the options/methods available from class _ ImgHelper _
ImgHelper ImageHelper = new ImgHelper(this);
- SetImageQuality (ImageQuality value) - Set the Quality of the image, default Document_Quality is used. If documents are used further for any automations and OCR, use Document_Quality .
Image Quality values are:
enum ImageQuality {
Photo_Quality,
Document_Quality,
Compressed_Document
}
Parameters: ImageQuality | Return: void
- SetPageLayout (LayoutType ltype)
Set the Layout for the image default layouts are:
enum LayoutType {
A1,
A2,
A3,
A4,
A5,
A6,
A7,
PHOTO,
CUSTOM
}
Parameters: LayoutType | Return: void
- SetDPI (DPI dpi_value)
Set DPI (depth per inch) for the image.
Default DPI values are:
enum DPI {
DPI_100,
DPI_150,
DPI_200,
DPI_300,
DPI_500,
DPI_600
}
Parameters: DPI | Return: void
- SetCustomWidth (int value)
If image need to set custom width.
Parameters: width value in pixels as integer type | Return: void
- SetCustomHeight (int value)
If image need to set custom height.
Parameters: width value in pixels as integer type | Return: void
- SetMaxSize (long SizeinKB)
Set max size limit for the image. Size will be considered in KB (Kilo Bytes).
Parameters: max size of image in Kilobytes as type long & Return: void
- Bitmap GetThumbnail (Bitmap bm, int reqHeight, int reqWidth,Boolean AspectRatio)
Will build thumbnail for the given image in custom width,height and AspectRatio
Parameters: Bitmap image , int Height , int Width ,Boolean Aspect** _ **Ratio
Return: Thumbnail for the image as Bitmap Type.
- int GetThumbNailHeight ()
To get height of the thumbnail to generate
Parameters: N/A | Return: height in pixel as type integer.
- int GetThumbNailWidth ()
To get width of the thumbnail to generate
Parameters: N/A | Return: width in pixel as type integer.
- Bitmap LoadImage (String inputputURI, int reqHeight,int reqWidth)
Will load and build bitmap image from provided URL in requested width and height.
Parameters: String inputputURI , int reqHeight ,int reqWidth
Return: Build image in type Bitmap.
- Bitmap rotateBitmap (Bitmap bitmap, int orientation)
Rotate the image to preferred orientation
Parameters: Bitmap image, int orientation
Return: Rotated image as per given orientation in type Bitmap.
- Boolean CompressToJPEG (Bitmap bm, String outputURI)
Will Compress the provided bitmap image and will save to given path.
Parameters: Bitmap image , String outputURI
Return: Boolean True/false as per the operation is success or failure
- Bitmap CompressAndGetThumbnail (Bitmap bm, String outputURI,int RotationDegree)
Will compress, rotate and build thumbnail image in bitmap type and will save to given path. And will return the same build thumbnail.
Parameters: Bitmap image, String outputURI,int RotationDegree.
Return: build thumbnail as type bitmap.
- String getCurrentImageQuality ()
Will provide the current set compress quality.
Parameters: Nil.
Return: Current compression quality in string.
ImgException class
As a part of exceptional error handling ImgException class is available. Following are the possible errors and corresponding codes:
- CREATE_FILE_ERROR = -100;
- IMAGE_ROTATION_ERROR = -101;
- LOAD_TO_BUFFER_ERROR = -102;
- DELETE_FILE_ERROR = -103;
- GET_ROTATION_ERROR = -104;
- ROTATE_BITMAP_ERROR = -105;
- BITMAP_RESIZE_ERROR = -106;
- CAMERA_HELPER_ERROR = -107;
- LOG_CREATION_ERROR = -108;
SDK Licensing
License file provided that should keep inside assets folder of main application and call UnlockImagingLibrary from ImgHelper class to unlock the SDK.
For UnlockImagingLibrary , need to pass main app activity context and the file.
Boolean UnlockImagingLibrary (Context activityContext , String licenseFile )
Will Unlock the Imaging library
Parameters: Context activityContext , String licenseFile
Return: true/false - unlock success / failed.
ImageHelper.UnlockImagingLibrary(this,"QuickCaptureSDKLicense.bin");
Once the license verification is success, then the water mark will disable from the images being generated by the SDK.