This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <input type="file" id="barcode-file" onchange="loadfile()" accept=".jpg,.jpeg,.png,.bmp" /> | |
| function loadfile() { | |
| let img = new Image(); | |
| var reader = new FileReader(); | |
| reader.onload = function (evt) { | |
| img.onload = function () { | |
| if (img.width > maxLength) { | |
| img.height = maxLength * img.height / img.width | |
| img.width = maxLength; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style> | |
| #container { | |
| position: relative; | |
| } | |
| #imageCanvas { | |
| position: relative; | |
| z-index: 1; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.6.0/dist/dbr.js" data-productKeys="LICENSE-KEY"></script> | |
| <style> | |
| #container { | |
| position: relative; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <apex:page > | |
| <html> | |
| <head> | |
| <script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@7.6.0/dist/dbr.js" data-productKeys="LICENSE-KEY"></script> | |
| </head> | |
| <body> | |
| <h1>Dynamsoft JavaScript Barcode SDK</h1> | |
| <p></p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.jsFunctions = { | |
| init: function(obj) { | |
| dotnetRef = obj; | |
| }, | |
| selectFile: function () { | |
| let input = document.createElement("input"); | |
| input.type = "file"; | |
| input.onchange = async function () { | |
| let file = input.files[0]; | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <button class="btn btn-primary" @onclick="ReadBarcodes">Read Barcodes from Files</button> | |
| @code { | |
| private static String result = "No Barcode Found"; | |
| protected override void OnInitialized() | |
| { | |
| JSRuntime.InvokeVoidAsync("jsFunctions.init", DotNetObjectReference.Create(this)); | |
| } | |
| public async Task ReadBarcodes() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> | |
| <title>BlazorBarcodeSample</title> | |
| <base href="/" /> | |
| <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" /> | |
| <link href="css/app.css" rel="stylesheet" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function acquireImage() { | |
| if (DWServiceObject) { | |
| var onSuccess, onFailure; | |
| onSuccess = onFailure = function () { | |
| DWServiceObject.CloseSource(); | |
| }; | |
| var deviceConfiguration = { | |
| SelectSourceByIndex: 0, | |
| IfShowUI: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function createScanObject(ip) { | |
| var dwtConfig={WebTwainId:ip, Host: ip, UseLocalService:'true'}; | |
| Dynamsoft.WebTwainEnv.CreateDWTObjectEx(dwtConfig, function (dwt) { | |
| DWServiceObject = dwt; | |
| DWServiceObject.RegisterEvent('OnPostTransferAsync', function(outputInfo){ | |
| DWServiceObject.ConvertToBlob( | |
| [DWServiceObject.ImageIDToIndex(outputInfo.imageId)], | |
| Dynamsoft.EnumDWT_ImageType.IT_PNG, | |
| function (result, indices, type) { | |
| DWObject.LoadImageFromBinary( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Hello World</title> | |
| <script src="dist/dynamsoft.webtwain.min.js"></script> | |
| </head> | |
| <body> | |
| <input type="button" value="Scan" onclick="AcquireImage();" /> | |
| <div id="dwtcontrolContainer"></div> | |
| <script type="text/javascript"> |