-
Notifications
You must be signed in to change notification settings - Fork 68
/
demo-08-scan-blank-detection.htm
79 lines (68 loc) · 3.14 KB
/
demo-08-scan-blank-detection.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html lang="en">
<head>
<title>Scanner.js demo: Scan with blank page detection</title>
<meta charset='utf-8'>
<script src="https://cdn.asprise.com/scannerjs/scanner.js" type="text/javascript"></script>
<script>
//
// Please read scanner.js developer's guide at: http://asprise.com/document-scan-upload-image-browser/ie-chrome-firefox-scanner-docs.html
//
/** Scan and upload in one go */
function scanAndUploadDirectly() {
scanner.scan(displayServerResponse,
{
"output_settings": [
{
"type": "upload",
"format": "pdf",
"discard_blank_pages": "false", /** Default value: false */
"blank_page_threshold": "0.02", /** Max ink coverage consider as blank */
"upload_target": {
"url": "https://asprise.com/scan/applet/upload.php?action=dump"
}
}
]
}
);
}
function displayServerResponse(successful, mesg, response) {
if(!successful) { // On error
document.getElementById('server_response').innerHTML = 'Failed: ' + mesg;
return;
}
if(successful && mesg != null && mesg.toLowerCase().indexOf('user cancel') >= 0) { // User cancelled.
document.getElementById('server_response').innerHTML = 'User cancelled';
return;
}
document.getElementById('server_response').innerHTML = scanner.getUploadResponse(response);
}
</script>
<style>
img.scanned {
height: 200px; /** Sets the display size */
margin-right: 12px;
}
div#images {
margin-top: 20px;
}
</style>
</head>
<body>
<h2>Scanner.js: Scan with Blank Page Detection</h2>
<button type="button" onclick="scanAndUploadDirectly();">Scan and Upload</button>
<div id="server_response"></div>
<!-- HELP_LINKS_START help links at the bottom -->
<style>
.asprise-footer, .asprise-footer a:visited { font-family: Arial, Helvetica, sans-serif; color: #999; font-size: 13px; }
.asprise-footer a { text-decoration: none; color: #999; }
.asprise-footer a:hover { padding-bottom: 2px; border-bottom: solid 1px #9cd; color: #06c; }
</style>
<div class="asprise-footer" style="margin-top: 48px;">
<a href="http://asprise.com/document-scan-upload-image-browser/direct-to-server-php-asp.net-overview.html" target="_blank" title="Opens in new tab">Scanner.js Homepage</a> |
<a href="http://asprise.com/scan/scannerjs/docs/html/scannerjs-javascript-guide.html" target="_blank" title="Opens in new tab">Developer's Guide to ScannerJs</a> |
<a href="https://github.com/Asprise/scannerjs.javascript-scanner-access-in-browsers-chrome-ie.scanner.js" target="_blank" title="Opens in new tab">Sample code on Github</a>
</div>
<!-- HELP_LINKS_END -->
</body>
</html>