// @20210818 160302 (function(){ "use strict"; var screenW = screen.width, promptDlgWidth = screenW > 550 ? 550 : (screenW - 10), promptDlgWidth2 = screenW > 680 ? 680 : (screenW - 10), reconnectTime = 0, imagesInBase64 = { icn_download: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAgCAYAAAAMq2gFAAABOklEQVRIie2WTW6DMBCFH4h1l22VqmqPVUEvEJa9gRt6FDhDpfx0FdJj+Arx3nldhEjEdchgWlaM9CSwMZ/fzMgQvX0TwvA+ePOpIsniRIwZGIl/n/8AGs3RWKB4JA4STjUKBo1EivLtGakEkP7Ru6vbpcpONzFxPFsazQloZyxEmkDepsYk0JIhkZGwzngfWRKvd0u1Pwf93k1NoBjg5uN+pbZuHn0gEFgQ2AVAdgTefQVzU9e2nzaplKbMkEhnK2W9oAOAC9IHIO+Yd5U/rJX2QbocnVSSqARuqse1Ki9BumrUp+U1gXkXRAoyBDIC1jNnCWRPG2Wug2SFrkkUnvHieaPqaxCpo3bL104rLySQviDbpNA0Sgl4W9kXfU9vjWPho+ZaHCHfo6r/kumfYUBEL1/jeJpqFBw/d5aBU2kHOMQAAAAASUVORK5CYII=', icn_install: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAA+klEQVRIid2SMWoCQRiFv3GnW7BII6ZPqeAlorewtBELsZdFOz2Q0VYkXQ6QA9iaIqU+mx2Y3QRd12WKffCY4WdmPt5jzPRT5PQOfOSHnky6/rnoqd/cJFt/0FB6I3UkWOVmZbz+GcyjLEjgeSjRzc3KuCMxzIC8fQwsbtTxqJan/jz+r7qZ4LWC2pzbgpkDmclBAG3gO011T0U+g9Mv8PayTY4u0UIQV5jGORYsAcz4oA7wBWR+SUWJAM5Az17E6gFIGUXA2goGJR8wAK1dUuiwVdECnpQZ7cOggiWy5zCcgIkCcbCX2iUKB6pfdfVLFAwUiNS4f6QaXQHE5K75dPBEiQAAAABJRU5ErkJggg==', icn_scan: 'data:image/png;base64,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SbkQIotT1i5ou1hUebi+ijbXXEN0X00dYNdFf2e0OpOvwLFunYK2i9bNwAAAAASUVORK5CYII=' }, ua = navigator.userAgent.toLowerCase(), arm64 = (/arm64|aarch64/g).test(ua), mips64 = (/mips64/g).test(ua); function getDebPath (strSuffix) { var _path = Dynamsoft.DWT.ResourcesPath; if(Dynamsoft.Lib.isString(_path) && _path.length > 0) { if (_path[_path.length - 1] != '/') { _path = _path + '/'; } } else { _path = 'Resources/'; } return [ _path, 'dist/DynamsoftServiceSetup-', strSuffix, '.deb' ].join(''); } Dynamsoft.OnWebTwainNotFoundOnWindowsCallback = function (ProductName, InstallerUrl, bHTML5, bIE, bSafari, bSSL, strIEVersion) { var _this = Dynamsoft, objUrl = { 'default': InstallerUrl }; _this._show_install_dialog(ProductName, objUrl, bHTML5, Dynamsoft.DWT.EnumDWT_PlatformType.enumWindow, bIE, bSafari, bSSL, strIEVersion); }; Dynamsoft.OnWebTwainNotFoundOnLinuxCallback = function (ProductName, strDebUrl, strRpmUrl, bHTML5, bIE, bSafari, bSSL, strIEVersion) { var _this = Dynamsoft, objUrl = { 'default': strDebUrl, 'deb': strDebUrl, 'rpm': strRpmUrl }; _this._show_install_dialog(ProductName, objUrl, bHTML5, Dynamsoft.DWT.EnumDWT_PlatformType.enumLinux, bIE, bSafari, bSSL, strIEVersion); }; Dynamsoft.OnWebTwainNotFoundOnMacCallback = function (ProductName, InstallerUrl, bHTML5, bIE, bSafari, bSSL, strIEVersion) { var _this = Dynamsoft, objUrl = { 'default': InstallerUrl }; _this._show_install_dialog(ProductName, objUrl, bHTML5, Dynamsoft.DWT.EnumDWT_PlatformType.enumMac, bIE, bSafari, bSSL, strIEVersion); }; Dynamsoft.dwt_change_install_url = function (url) { var install = document.getElementById('dwt-btn-install'); if (install) install.href = url; }; Dynamsoft.DWT_Reconnect = function () { var _this = Dynamsoft; if (((new Date() - reconnectTime) / 1000) > 30) { // change prompt var el = document.getElementById('dwt-btn-install'); if (el) { el.innerHTML = 'Failed to connect to the service, have you run the setup?
If not, please run the setup and click here to connect again.'; } return; } if (_this.DWT) { _this.DWT.CheckConnectToTheService(function () { _this.DWT.ConnectToTheService(); }, function () { setTimeout(Dynamsoft.DWT_Reconnect, 500); }); } else { console.log("The Dynamsoft namespace is missing"); } }; Dynamsoft.DCP_DWT_onclickInstallButton = function () { var btnInstall = document.getElementById('dwt-btn-install'); if (btnInstall) { setTimeout(function () { var install = document.getElementById('dwt-install-url-div'); if (install) install.style.display = 'none'; var el = document.getElementById('dwt-btn-install'); if (el && el.getAttribute("html5") == "1") { var pel = el.parentNode, newDiv = document.createElement('div'); newDiv.id = 'dwt-btn-install'; newDiv.style.textAlign = "center"; newDiv.style.paddingBottom = '15px'; newDiv.innerHTML = 'Connecting to the service...'; newDiv.setAttribute("html5", "1"); pel.removeChild(el); pel.appendChild(newDiv); reconnectTime = new Date(); setTimeout(Dynamsoft.DWT_Reconnect, 10); } else { var pel = el.parentNode; pel.removeChild(el); } }, 10); } return true; }; Dynamsoft._show_install_dialog = function (ProductName, objInstallerUrl, bHTML5, iPlatform, bIE, bSafari, bSSL, strIEVersion) { var _this = Dynamsoft, ObjString, title, browserActionNeeded; title = 'Please complete one-time setup'; ObjString = [ '
', title, '
']; if (_this.DWT) { if (iPlatform == Dynamsoft.DWT.EnumDWT_PlatformType.enumLinux || navigator.userAgent.toLowerCase().indexOf("firefox") > -1) { browserActionNeeded = 'RESTART'; } else { browserActionNeeded = 'REFRESH'; } ObjString.push('
'); ObjString.push('
'); ObjString.push('
'); ObjString.push('download'); ObjString.push('install'); ObjString.push('scan'); ObjString.push('
Download'); ObjString.push('Install'); ObjString.push('Scan'); ObjString.push('
'); ObjString.push('
'); if (bHTML5 && iPlatform == Dynamsoft.DWT.EnumDWT_PlatformType.enumLinux) { ObjString.push('
'); ObjString.push('
'); if(arm64 || mips64) { if(arm64) objInstallerUrl['default'] = getDebPath('arm64'); else if(mips64) objInstallerUrl['default'] = getDebPath('mips64el'); } else { ObjString.push('
'); ObjString.push('
'); } ObjString.push('
'); } ObjString.push('
Download
'); if (bHTML5) { if (bIE) { ObjString.push('
'); ObjString.push('If you still see the dialog after installing the scan service, please
'); ObjString.push('1. Add the website to the zone of trusted sites.
'); ObjString.push('IE | Tools | Internet Options | Security | Trusted Sites.
'); ObjString.push('2. Refresh your browser.'); ObjString.push('
'); } else { if (iPlatform == Dynamsoft.DWT.EnumDWT_PlatformType.enumLinux) { ObjString.push('
'); ObjString.push('
After the installation, please ' + browserActionNeeded + ' your browser.
'); ObjString.push('
'); } } } else { ObjString.push('
'); if (bIE) { ObjString.push('After the installation, please
'); ObjString.push('1. Restart the browser
'); ObjString.push('2. Allow "DynamicWebTWAIN" add-on to run by right clicking on the Information Bar in the browser.'); } else { ObjString.push('
After installation, please REFRESH your browser.
'); } ObjString.push('
'); } _this.DWT.ShowDialog(promptDlgWidth, 0, ObjString.join('')); } else { console.log("The Dynamsoft namespace is missing"); } }; Dynamsoft.OnWebTwainNeedUpgradeCallback = function (ProductName, objInstallerUrl, bHTML5, iPlatform, bIE, bSafari, bSSL, strIEVersion, bForceUpgrade, bError, strErrorString) { Dynamsoft._show_install_dialog(ProductName, objInstallerUrl, bHTML5, iPlatform, bIE, bSafari, bSSL, strIEVersion); }; Dynamsoft.OnWebTwainPreExecuteCallback = function () { var _this = Dynamsoft; if (_this.DWT) { _this.DWT.OnWebTwainPreExecute(); } else { console.log("The Dynamsoft namespace is missing"); } }; Dynamsoft.OnWebTwainPostExecuteCallback = function () { var _this = Dynamsoft; if (_this.DWT) { _this.DWT.OnWebTwainPostExecute(); } else { console.log("The Dynamsoft namespace is missing"); } }; Dynamsoft.OnRemoteWebTwainNotFoundCallback = function (ProductName, ip, port, bSSL, bMobile) { var _this = Dynamsoft; var ObjString; if(bMobile) { ObjString = [ '
', 'The Dynamsoft Service is not configured correctly on ', '"', ip, '". Please check.', '
' ]; } else { ObjString = [ '
', 'Dynamsoft Service is missing a certificate for the following IP/domain
', 'or isn\'t installed on the PC with the following IP/domain
', '"', ip, '".
', 'Please make sure you have put the correct certificate
', 'in the {Dynamsoft Service Directory}
', 'or that Dynamsoft Service is installed on that specified PC.', '
', '
', '
After installation, please REFRESH your browser.
' ]; } if (_this.DWT) { _this.DWT.ShowDialog(promptDlgWidth, 0, ObjString.join('')); } else { console.log("The Dynamsoft namespace is missing"); } }; Dynamsoft.OnRemoteWebTwainNeedUpgradeCallback = function (ProductName, ip, port, bSSL) { var _this = Dynamsoft; var ObjString = [ '
', 'Dynamsoft Service is outdated on the PC with IP/domain
', '"', ip, '".
', 'Please open the page on that PC to download and install it.', '
', '
', '
After installation, please REFRESH your browser.
' ]; if (_this.DWT) { _this.DWT.ShowDialog(promptDlgWidth, 0, ObjString.join('')); } else { console.log("The Dynamsoft namespace is missing"); } }; Dynamsoft.OnWebTWAINDllDownloadSuccessful = function () { console.log('The Web TWAIN Module was downloaded successfully!'); }; Dynamsoft.OnWebTWAINDllDownloadFailure = function (ProductName, errorCode, errorString) { var _this = Dynamsoft; if (_this.DWT) { if (errorCode == -2371/* EnumDWT_Error.ModuleNotExists*/) { var ObjString = [ '
', errorString, '
', '
', '
You can try REFRESHING your browser to try again.
If the issue persists, please contact the website administrator.
' ]; _this.DWT.ShowDialog(promptDlgWidth, 0, ObjString.join('')); } return true; } else { console.log("The Dynamsoft namespace is missing"); } }; Dynamsoft.OnGetServiceUpdateStatus = function (bError, statusCode, statusString) { if (statusString != "Update skipped") console.log(statusString); }; Dynamsoft.OnWebTWAINModuleDownloadManually = function (objInstallerUrl, iPlatform, bIE, bSafari, bSSL, strIEVersion) { var _this = Dynamsoft; return _this._show_install_dialog('', objInstallerUrl, true, iPlatform, bIE, bSafari, bSSL, strIEVersion); }; Dynamsoft.OnLTSLicenseError = function (message) { var addMessage = '', ObjString, lexp = Dynamsoft.DWT.licenseException, code = 0; if(lexp) code = lexp.code; if(code == -2440 || // NetworkError code == -2441 || // Timedout code == -2443 || // CorsError code == -2446 || // LtsJsLoadError message.indexOf('Internet connection')>-1 || message.indexOf('Storage')>-1) { var purchaseUrl = 'https://www.dynamsoft.com/customer/license/trialLicense?product=dwt&deploymenttype=js'; addMessage = '
You can register for a free 30-day trial here. Make sure to select the product Dynamic Web TWAIN.
'; } ObjString = [ '
', '
Error
x
', '
', message, addMessage, '
' ]; Dynamsoft.Lib.ShowLicenseDialog(ObjString.join(''), { width: promptDlgWidth2, height: 0, bClose: true }); }; Dynamsoft.OnLTSConnectionFailure = Dynamsoft.OnLTSLicenseError; Dynamsoft.OnLTSReturnedAnError = Dynamsoft.OnLTSLicenseError; Dynamsoft.OnLTSUUIDError = Dynamsoft.OnLTSLicenseError; Dynamsoft.OnLTSConnectionWarning = function () { var ObjString = [ '
', '
Warning
x
', '
', 'Warning: You are seeing this dialog because Dynamic Web TWAIN has failed to connect to the License Tracking Server. ', 'A cached authorization is being used, and you can continue to use the software as usual. ', 'Please get connected to the network as soon as possible. ', Dynamsoft.DWT.isPublicLicense() ? 'Contact Dynamsoft ' : 'Contact the site administrator ', 'for more information.', '
' ].join(''); Dynamsoft.Lib.ShowLicenseDialog(ObjString, { width: promptDlgWidth2, height: 0, bClose: true }); }; Dynamsoft.OnLTSPublicLicenseMessage = function (message) { var ObjString = [ '
', '
Warning
x
', '
', message, '
' ].join(''); Dynamsoft.Lib.ShowLicenseDialog(ObjString, { width: promptDlgWidth2, height: 0, bClose: true }); }; })();