Dynamic Web TWAIN: How can I insert new scanned images to an existing multi-page file

To do this, you just need to set the property IfAppendImage to 'false'.

You can load some images from your local disk first, and then acquire images from your device with IfAppendImage set to 'false'.

Code Snippet

//Callback functions for async APIs
function OnSuccess(){ 
    console.log('successful'); 
}
function OnFailure(errorCode, errorString){ 
    alert(errorString); 
}

function LoadImage() {
    var DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
    if (DWObject) {
        DWObject.IfShowFileDialog = true; 
        DWObject.LoadImageEx("", EnumDWT_ImageType.IT_ALL, OnSuccess, OnFailure); 
    }
}    

function AcquireImage() {
    var DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
    if (DWObject) {
        DWObject.IfDisableSourceAfterAcquire = true;
        DWObject.SelectSource();
        DWObject.OpenSource();
        //If the value of the property is set to 'true', the new scanned/loaded image will be appended to the last image in buffer;
        //if it's set to 'false', the image will be inserted before the current image.
        DWObject.IfAppendImage = false;
        DWObject.AcquireImage();
    }
}
Is this page helpful?

Leave a Reply

Your email address will not be published.