dynamsoft-javascript-barcode-7.0-12

by DynamsoftTeam

HTML

<!DOCTYPE html>
<html>

<body>
    <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.32/dist/dbr.js"></script>
    <script>
    		// specify a license, you can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=guide&product=dbr&package=js to get your own trial license good for 30 days. 
        Dynamsoft.DBR.BarcodeScanner.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
        (async()=>{
            let scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
            
            let settings = await scanner.getRuntimeSettings();
            /*
             * 1 means true
             * Using a percentage is easier
             * The following code ignores 25% to each side of the video stream
             */
            settings.region.regionMeasuredByPercentage = 1;
            settings.region.regionLeft = 25;
            settings.region.regionTop = 25;
            settings.region.regionRight = 75;
            settings.region.regionBottom = 75;
            await scanner.updateRuntimeSettings(settings);
            
            scanner.onFrameRead = results => {console.log(results);};
            scanner.onUniqueRead = (txt, result) => {alert(txt);};
            await scanner.show();
        })();
    </script>
</body>

</html>