用户扫描文档后 - 我想让他们选择保存文件的位置,保存文件,最后返回他们刚刚保存的文件的路径。
我正在尝试使用“ OnGetFilePath ”事件,但它不起作用。
JS代码在这里:
var DWObject;
Dynamsoft.WebTwainEnv.AutoLoad = false;
Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);
function LoadEnv() {
Dynamsoft.WebTwainEnv.Load();
}
function Dynamsoft_OnReady() {
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
if (DWObject) {
DWObject.IfShowFileDialog = true;
DWObject.RegisterEvent('OnGetFilePath', OnGetFilePath);
DWObject.SelectSource(function () {
DWObject.OpenSource();
DWObject.IfDisableSourceAfterAcquire = true;
DWObject.AcquireImage(OnAcquireImageSuccess, OnAcquireImageFailure);
}, function () {
console.log('SelectSource failed!');
});
}
}
function OnAcquireImageSuccess() {
console.log('Successfully aquired image');
SavePDF();
DWObject.CloseSource();
}
//File saved to disk successfully
function SavePDF() {
DWObject.SaveAsPDF('file.pdf');
}
//Not Fired
function OnGetFilePath(bSave, filesCount, index, path, filename) {
console.log("File Path!");
}