我在使用 angular 4 的网络应用程序上使用动态网络吐温,扫描后保存文档时遇到问题我在吐温文档中找到了此功能:
function DynamicWebTwain_OnPostTransfer() { //fires after each scan
var strFileName;
var Digital = new Date();
var Month = Digital.getMonth() + 1;
var Day = Digital.getDate();
var Hour = Digital.getHours();
var Minute = Digital.getMinutes();
var Second = Digital.getSeconds();
var CurrentTime = Month + "_" + Day + "_" + Hour + "_" + Minute + "_" + Second;
strFileName = "D:/temp/"+CurrentTime + ".pdf";
DWObject.SaveAsPDF(strFileName,DWObject.CurrentImageIndexInBuffer); //save each scanned image as a different PDF file
if (DWObject.ErrorCode != 0) {
alert (DWObject.ErrorString);
}
}
但问题是我不知道将它放在我的 twain.js 中的哪个位置以及它应该如何工作这是我的 twain.js
var app = angular.module('WebScanning', []);
app.controller('twainControl',function twainControl($scope) {
$scope.acquireImage = function() {
var DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'.
DWObject.IfDisableSourceAfterAcquire = true; // Source will be closed automatically after acquisition.
DWObject.SelectSource(); // Select a Data Source (a device like scanner) from the Data Source Manager.
DWObject.OpenSource(); // Open the source. You can set resolution, pixel type, etc. after this method. Please refer to the sample 'Scan' -> 'Custom Scan' for more info.
DWObject.AcquireImage();
};
});
任何想法?