Document scanning SDK
Once the premium module has been added to your app, you may use the following APIs to access its functionality .

Implementation Guide

Create a javascript function to accept a scanned image. It will be called with an object with the fields:
    image: a base64 encoded string representing the jpeg image file
    mimeType: 'image/jpeg'
    encoding: 'base64'
To initiate a scan, open the url:
gonative://documentScanner/scanPage?callback=CALLBACKFUNCTION
Replace CALLBACKFUNCTION with your actual javascript function name.
Here is the source code for a demo that simply displays the scanned image.
1
<html>
2
<head>
3
<meta name="viewport" content="width=device-width, initial-scale=1">
4
<title>Document Scanner Test</title>
5
<script>
6
function callback(data) {
7
document.getElementById('page').setAttribute('src', 'data:' + data.mimeType +
8
';' + data.encoding + ', ' + data.image);
9
}
10
</script>
11
<style>
12
img
13
{
14
max-width: 100%;
15
min-width: 300px;
16
height: auto;
17
}
18
</style>
19
</head>
20
<body>
21
22
<h1>Document Scanner test</h1>
23
24
<p><a href="gonative://documentScanner/scanPage?callback=callback">Scan page</a></p>
25
26
<p><img id="page" src=""/></p>
27
28
</body>
29
</html>
30
Copied!
Last modified 1yr ago
Copy link