I want to use an ActiveX control from Dynamsoft to scan documents and reading barcodes from documents.
Scanning works just fine. But reading barcodes gives an error creating ActiveX control. The samples they provide all work so I must be doing something wrong.
Can someone help me with this? Please find code here
It appears that the Class is IAddon (not Addon). Typically once you instantiate the control (Display @DynamicWebTwain, you shouldn't need to display again,you typically use Modify to bring in the functions of the control. So first try and use IAddon and then try using Modify @IAddon and see if the error continues.
I want to use an ActiveX control from Dynamsoft to scan documents and reading barcodes from documents.
Scanning works just fine. But reading barcodes gives an error creating ActiveX control. The samples they provide all work so I must be doing something wrong.
Can someone help me with this? Please find code here
Thank you for your reply shjerpe. I am not so good in translating this kind of code so if you could help with the syntax I would be very greatful.
I need the handle for @Iaddon and @Ibarcode and I thought this would be done by using the display statement.
The function I need is the @Read statement which gives the content of a barcode.
CLASS @IBarcode
CLSID, CC48C3D2-8F84-4011-BD6D-A8D2F42384B4
NAME, "IBarcode"
*[Class: @IBarcode] Read
* method Read
METHOD, 1, @Read,
"short" @sImageIndex, TYPE 2,
"int" @format, TYPE 22
RETURNING "VARIANT", TYPE 12
Can you help me with this?
Regards
André
I want to use an ActiveX control from Dynamsoft to scan documents and reading barcodes from documents.
Scanning works just fine. But reading barcodes gives an error creating ActiveX control. The samples they provide all work so I must be doing something wrong.
Can someone help me with this? Please find code here
I'll try, but this is a complicated control. Does the vendor fr the control provide any VB or C or C# examples.
77 H-Barcode handle of @Barcode.
try
77 H-Barcode handle of @IBarcode.
I wonder if you need this line of code DISPLAY @DynamicWebTwain - comment it out and
DISPLAY @IBarcode
line 2 col 2 lines 10 size 30
license-key " "
handle in H-Barcode
modify H-Barcode "@Read" (() returning my-val
you'll actually need to put item in the () a short and an int to match what the function is expecting.
I want to use an ActiveX control from Dynamsoft to scan documents and reading barcodes from documents.
Scanning works just fine. But reading barcodes gives an error creating ActiveX control. The samples they provide all work so I must be doing something wrong.
Can someone help me with this? Please find code here
Hello shjerpe,
I tried
77 H-Barcode handle of @IBarcode. and this works
So I have the handle for @Ibarcode and @Iaddon
inquire H-DynamicWebTwain @addon IN h-addon.
inquire h-addon @Barcode IN h-barcode.
So far so good. But when I want to read the barcode or find out how many barcodes there are (Barcodecount) I get no result
They have samples which are written in HTML&JS
<!DOCTYPE html>
<html>
<head>
<title>Use Dynamic Web TWAIN to read Barcode</title>
<script type="text/javascript" src="Resources/dynamsoft.webtwain.initiate.js"> </script>
<script type="text/javascript" src="Resources/dynamsoft.webtwain.config.js"> </script>
</head>
<body>
<input type="button" value="Scan" onclick="AcquireImage();" />
<input type="button" value="Load" onclick="LoadImage();" /><br />
<select size="1" id="barcodeformat" style="position: relative; width: 220px;"></select>
<input type="button" value="Read Barcode" onclick="ReadBarcode();" />
<!-- dwtcontrolContainer is the default div id for Dynamic Web TWAIN control.
If you need to rename the id, you should also change the id in the dynamsoft.webtwain.config.js accordingly. -->
<div id="dwtcontrolContainer"></div>
<script type="text/javascript">
Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady); // Register OnWebTwainReady event. This event fires as soon as Dynamic Web TWAIN is initialized and ready to be used
var DWObject;
function Dynamsoft_OnReady() {
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
if (DWObject) {//Currently only code 39 and code 128 are supported
document.getElementById("barcodeformat").options.add(new Option("Code 39", 1));
document.getElementById("barcodeformat").options.add(new Option("Code 128", 0));
}
}
function AcquireImage() {
if (DWObject) {
DWObject.SelectSource();
DWObject.OpenSource();
DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
DWObject.AcquireImage();
}
}
//Callback functions for async APIs
function OnSuccess() {
console.log('successful');
}
function OnFailure(errorCode, errorString) {
alert(errorString);
}
function LoadImage() {
if (DWObject) {
DWObject.IfShowFileDialog = true; // Open the system's file dialog to load image
DWObject.LoadImageEx("", EnumDWT_ImageType.IT_ALL, OnSuccess, OnFailure); // Load images in all supported formats (.bmp, .jpg, .tif, .png, .pdf). OnSuccess or OnFailure will be called after the operation
}
}
function GetBarcodeInfo(sImageIndex, result) {//This is the function called when barcode is read successfully
//Retrieve barcode details
var count = result.GetCount();
if (count == 0) {
alert("The barcode for the selected format is not found.");
return;
} else {
for (i = 0; i < count; i ) {
var text = result.GetContent(i);
var x = result.GetX1(i);
var y = result.GetY1(i);
var format = result.GetFormat(i);
var barcodeText = ("barcode[" (i 1) "]: " text "\\n");
barcodeText = ("format:" (format==4?"Code 39":"Code 128") "\\n");
barcodeText = ("x: " x " y:" y "\\n");
alert(barcodeText);
}
}
}
function GetErrorInfo (errorcode, errorstring) {//This is the function called when barcode reading fails
alert(errorstring);
}
function ReadBarcode() {
if (DWObject) {
if (DWObject.HowManyImagesInBuffer == 0) {
alert("Please scan or load an image first.");
return;
}
//Get barcode result.
switch (document.getElementById("barcodeformat").selectedIndex) {
case 0:
result = DWObject.Addon.Barcode.Read(
DWObject.CurrentImageIndexInBuffer, EnumDWT_BarcodeFormat.CODE_39, GetBarcodeInfo, GetErrorInfo);
break;
case 1:
result = DWObject.Addon.Barcode.Read(
DWObject.CurrentImageIndexInBuffer, EnumDWT_BarcodeFormat.CODE_128, GetBarcodeInfo, GetErrorInfo);
break;
default:
break;
}
}
}
</script>
</body>
</html>
I want to use an ActiveX control from Dynamsoft to scan documents and reading barcodes from documents.
Scanning works just fine. But reading barcodes gives an error creating ActiveX control. The samples they provide all work so I must be doing something wrong.
Can someone help me with this? Please find code here
I apologize. I've provided as much as I know. I'm sure there is a way the control gathers the info to do the read but it is beyond my skills. - Steve
I want to use an ActiveX control from Dynamsoft to scan documents and reading barcodes from documents.
Scanning works just fine. But reading barcodes gives an error creating ActiveX control. The samples they provide all work so I must be doing something wrong.
Can someone help me with this? Please find code here
Ok Steve thank you for your help.
I got a little bit further in my search. The next line returns a value in w-var-variant.
But when I want to use C$GETVARIANT it says Invalid or missing parameter to "C$GETVARIANT"
modify H-Barcode @Read (
by name sImageIndex 1
by name format 16)
Returning W-Var-variant.
call "C$GETVARIANT" using W-Var-VARIANT, w-var-text
I want to use an ActiveX control from Dynamsoft to scan documents and reading barcodes from documents.
Scanning works just fine. But reading barcodes gives an error creating ActiveX control. The samples they provide all work so I must be doing something wrong.
Can someone help me with this? Please find code here
Is W-Var-variant defined in linkage as usage handle?
I want to use an ActiveX control from Dynamsoft to scan documents and reading barcodes from documents.
Scanning works just fine. But reading barcodes gives an error creating ActiveX control. The samples they provide all work so I must be doing something wrong.
Can someone help me with this? Please find code here
Hello Steve,
I gave up on this control. I found another one from viscomsoft and I got it working in a few hours.
Anyway thanks for your help
André