0

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.

4

1 回答 1

0

这是来自 Dynamsoft 的 Rachel。感谢您使用我们的 Dynamic Web TWAIN SDK。

您可以像下面这样更新代码,然后再试一次,看看它是如何工作的。

  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}));
}
于 2013-06-06T06:25:49.213 回答