-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgs1databar-t.html
45 lines (45 loc) · 2.4 KB
/
gs1databar-t.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- <script src="https://npm.scannerproxy.com/cdn/@scannerproxy/dynamsoft-javascript-barcode@9.6.1-dev-20221223114035/dist/dbr.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.1-iv-202212230033/dist/dbr.js"></script>
<script>
// Specifies a license, you can visit https://www.dynamsoft.com/customer/license/trialLicense?ver=9.6.1&utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
Dynamsoft.DBR.BarcodeScanner.license = 't0068NQAAAIdmrODIhcOU/lz3L6PADYm6qvO76vXyXD1fDMdchoISXlRCMLu+ZXhOBGAwMGGrVe1K2PJpk0tNap7NdS86M1g=';
// Initializes and uses the SDK
(async () => {
let scanner = self.scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
await scanner.updateRuntimeSettings('speed');
let rs = await scanner.getRuntimeSettings();
rs.expectedBarcodesCount = 1;
rs.deblurLevel = 1;
// gs1databars do not contains connected blocks, so we need lines to detect
rs.localizationModes = [Dynamsoft.DBR.EnumLocalizationMode.LM_CONNECTED_BLOCKS, Dynamsoft.DBR.EnumLocalizationMode.LM_SCAN_DIRECTLY, Dynamsoft.DBR.EnumLocalizationMode.LM_LINES, 0,0,0,0,0];
rs.region.regionLeft = 5;
rs.region.regionTop = 35;
rs.region.regionRight = 95;
rs.region.regionBottom = 65;
rs.region.regionMeasuredByPercentage = 1;
await scanner.updateRuntimeSettings(rs);
let ss = await scanner.getScanSettings();
ss.whenToPlaySoundforSuccessfulRead = 'frame';
ss.oneDRememberFrameCount = 1; // If there is a wrong decoding, it is recommended to comment out this line.
await scanner.updateScanSettings(ss);
if(null != scanner.resultHighlightingTimeout){scanner.resultHighlightingTimeout = 100;}
scanner.onFrameRead = results => {
if (results.length > 0) console.log(results);
};
scanner.onUniqueRead = (txt, result) => {
alert(txt);
};
await scanner.show();
})();
</script>
</body>
</html>