I am using Dynamic Web TWAIN with which I can manipulate the settings of a scanner with javascript, my problem is that I can not recover the images once scanned to save them in a database, I have this function that converts an image into base64 I put it inside the OnPostTransfer function where the scanned images are loaded, I try to save them in an array but although the images are stored sometimes the last image is superimposed, that is, I scan two images and only save one, I would appreciate your help.
var imagenes = [];
DWObject.RegisterEvent('OnPostTransfer', function(){
DWObject.ConvertToBase64 ([0,3], EnumDWT_ImageType.IT_PDF,
asyncSuccessFunc, asyncFailureFunc);
function asyncSuccessFunc (result) {
var length=result.getLength();
imagenes.push(result.getData(0,length));
console.log(result.getData(0,length));
}
function asyncFailureFunc (errorCode, errorString) {
alert("ErrorCode: "+errorCode +"\r"+"ErrorString:"+ errorString);
}
});