i am using dynaimc web twain to scan images.

    function scan() {
    ......
    .....
    dynamicWebTwain1.AcquireImage();
                 dynamicWebTwain1.attachEvent('OnPostAllTransfers',dynamicWebTwain1_OnPostAllTransfers);
                 zAu.send(new zk.Event(zk.Widget.$('$btnScan'), 'onScan', null, {toServer:true}));
    }

    function dynamicWebTwain1_OnPostAllTransfers(){
    ........
    ...........
    strActionPage += "&AttachmentCode="+attachmentCode+"&AttachmentDesc="+attachmentDesc+"&AttachmentDetail="+attachmentDetail+"&FileType="+fileType+"&FileName="+fileName;
    dynamicWebTwain1.HTTPUploadAllThroughPostAsPDF(document.location.hostname, strActionPage, fileName);
    }

problem is before completion of dynamicWebTwain1_OnPostAllTransfers(){ } method zAu.send(new zk.Event(zk.Widget.$('$btnScan'), 'onScan', null, {toServer:true})); is beign called which is creating an issue for me..is there any way by which i can hold the execution of zAu.send(new zk.Event(zk.Widget.$('$btnScan'), 'onScan', null, {toServer:true})); untill dynamicWebTwain1_OnPostAllTransfers(){ completes.

有帮助吗?

解决方案

This is Rachel from Dynamsoft. Thanks for using our Dynamic Web TWAIN SDK.

You can update the code like below and try again to see how it works.

  function scan() {
......
.....
dynamicWebTwain1.AcquireImage(); //this method is non-blocking
             dynamicWebTwain1.attachEvent('OnPostAllTransfers',dynamicWebTwain1_OnPostAllTransfers);

}
function dynamicWebTwain1_OnPostAllTransfers(){
........
...........
strActionPage += "&AttachmentCode="+attachmentCode+"&AttachmentDesc="+attachmentDesc+"&AttachmentDetail="+attachmentDetail+"&FileType="+fileType+"&FileName="+fileName;
dynamicWebTwain1.HTTPUploadAllThroughPostAsPDF(document.location.hostname, strActionPage, fileName);
zAu.send(new zk.Event(zk.Widget.$('$btnScan'), 'onScan', null, {toServer:true}));
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top