[SOLVED] Html/JavaScript-Integration for a barcode-reader

Answered
0
0

I have a html-file with this Code. It loads a Barcode from file and does decode the Barcode. As normal html-file it works fine. I have inserted this Code in a htmlPanel in the Html-Property but decoding the Barcode does not work. I use https and the WisejResources Attribute in the AssemblyInfo.cs is activated.

Can someone please Show me how to implement this html-file in a Wisej-Project so that the Decoding works.

 

<!DOCTYPE html>
<html>
<body>
<input id=”iptDecodeImg” type=”file” accept=”image/bmp,image/jpeg,image/png,image/gif”>
<script src=”https://demo.dynamsoft.com/dbr_wasm/js/dbr-6.5.1.min.js”></script>
<script>
// https://www.dynamsoft.com/CustomerPortal/Portal/TrialLicense.aspx
BarcodeReader.licenseKey = “t0068NQAAADglj5HyNCM4uLbtypihLWxLIdxNXS+RqESWToHyCfM+BDLmE//DaJo+lB9ZV54tUx1QnEz4UabIgodd58+9MSk=”;let reader;
BarcodeReader.createInstance().then(r => reader = r );

        document.getElementById(‘iptDecodeImg’).addEventListener(‘change’, function(){
if(!reader){return;}
reader.decode(this.files[0]).then(results => {
if (results.length > 0) {
console.log(results);
var txts = [];
for (var i = 0; i < results.length; ++i) {
txts.push(results[i].BarcodeText);
}
alert(txts.join(“\n”));
this.value = ”;
}
else
{
alert(“No barcode found.”);
this.value = ”;
}
});
});
</script>
</body>
</html>
  • You must to post comments
Best Answer
0
0

Fritz,

 

html content with JavaScript can´t be put into an HTML panel as the JavaScript is not executed by the browser.
Try using a page in an iFrame (panel) instead.

Hope that helps.

Best regards
Frank

  • Fritz Müller
    Hello Frank, thank you that works fine.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.