彩票走势图

Dynamic Web TWAIN常见问题(六):编程问题-如何使用SSL?

翻译|使用教程|编辑:莫成敏|2020-05-06 11:01:17.920|阅读 359 次

概述:本文汇集了一些Dynamic Web TWAIN编程方面的常见问题,并且针对这些问题进行了回答,感兴趣的朋友快来了解一下吧~

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

Dynamic Web TWAIN是一个专为Web应用程序设计的TWAIN扫描识别控件。你只需在TWAIN接口写几行代码,就可以用兼容TWAIN的扫描仪扫描文档或从数码相机/采集卡中获取图像。然后用户可以编辑图像并将图像保存为多种格式,用户可保存图像到远程数据库或者SharePoint。该TWAIN控件还支持上传和处理本地图像。

本文汇集了一些Dynamic Web TWAIN编程方面的常见问题,并且针对这些问题进行了回答,感兴趣的朋友快来了解一下吧~

点击下载Dynamic Web TWAIN正式版


问题1:如何上传到Web服务器?

答:代码如下

DWObject = document.getElementById("dwtcontrolContainer"); = document.getElementById("dwtcontrolContainer");
//dwtcontrolContainer is the id of the Dynamic Web TWAIN on the page (An object or an embed).//dwtcontrolContainer is the id of the Dynamic Web TWAIN on the page (An object or an embed).
function btnScan_onclick() function btnScan_onclick() 
{{
DWObject.SelectSource();DWObject.SelectSource();
DWObject.OpenSource();DWObject.OpenSource();
DWObject.AcquireImage();DWObject.AcquireImage();
}}
function btnUpload_onclick() function btnUpload_onclick() 
{{
var strActionPage;var strActionPage;
var strHostIP;var strHostIP;
var CurrentPathName = unescape(location.pathname); // get current PathName in var CurrentPathName = unescape(location.pathname); // get current PathName in 
plain ASCII 
var CurrentPath = CurrentPathName.substring(0, CurrentPathName.lastIndexOf("/") var CurrentPath = CurrentPathName.substring(0, CurrentPathName.lastIndexOf("/") 
+ 1); + 1); 
strActionPage = CurrentPath + "SaveToFile.aspx"; //the ActionPage's file path= CurrentPath + "SaveToFile.aspx"; //the ActionPage's file path
strHostIP = "localhost"; //The host's IP or name = "localhost"; //The host's IP or name 
DWObject.HTTPPort = 80; DWObject.HTTPPort = 80; 
DWObject.HTTPUploadThroughPost(strHostIP,0,strActionPage,"imageData.tif");DWObject.HTTPUploadThroughPost(strHostIP,0,strActionPage,"imageData.tif");
if (DWObject.ErrorCode != 0)if (DWObject.ErrorCode != 0)
alert(DWObject.ErrorString);(DWObject.ErrorString);
else //succeedelse //succeed
alert("Image Uploaded successfully");("Image Uploaded successfully");
}}

问题2:如何使用ADF?我们希望将每个文档保存在单独的文件中。

答:代码如下

var iDocumentCounter =0; iDocumentCounter =0;

function BeginScan(){function BeginScan(){
    DWObject.OpenSource();DWObject.OpenSource();

    DWObject.IfShowUI = false;DWObject.IfShowUI = false;
    DWObject.IfDisableSourceAfterAcquire = true;DWObject.IfDisableSourceAfterAcquire = true;
    If(DWObject.Duplex != EnumDWT_DUPLEX.TWDX_NONE)If(DWObject.Duplex != EnumDWT_DUPLEX.TWDX_NONE)
        DWObject.IfDuplexEnabled = true; //enable duplexDWObject.IfDuplexEnabled = true; //enable duplex

DWObject.IfFeederEnabled = true;DWObject.IfFeederEnabled = true;
    if (DWObject.IfFeederEnabled == true){if (DWObject.IfFeederEnabled == true){
         DWObject.XferCount = -1;DWObject.XferCount = -1;

         if(DWObject.IfFeederLoaded == True)if(DWObject.IfFeederLoaded == True)
             DWObject.AcquireImage();DWObject.AcquireImage();
    }}
}}

function DWObject_OnPosttransfer(){function DWObject_OnPosttransfer(){
iDocumentCounter = iDocumentCounter + 1;= iDocumentCounter + 1;

if(DWObject.SaveAsBMP("C:\\Image\\" + iDocumentCounter + ".bmp", 0) == false)if(DWObject.SaveAsBMP("C:\\Image\\" + iDocumentCounter + ".bmp", 0) == false)
    alert( DWObject.ErrorString);( DWObject.ErrorString);
}}

问题3:如何使用SSL?

答:您可以使用IfSSL属性。以下JavaScript示例显示了如何使用IfSSL属性。

function btnUpload_onclick()  btnUpload_onclick() 
{{
   DWObject.HTTPPort = 80; DWObject.HTTPPort = 80; 
   DWObject.IfSSL = false; // if 80 is the port number of DWObject.IfSSL = false; // if 80 is the port number of 
non-secure port-secure port

   /* /* 
   DWObject.HTTPPort = 443; 
   DWObject.IfSSL = true; // if 443 is the port number of secure 
port
   */

   DWObject.HTTPUploadThroughPost("127.0.0.1", 0, DWObject.HTTPUploadThroughPost("127.0.0.1", 0, 
"/SaveToFile.php", "imageData.jpg");"/SaveToFile.php", "imageData.jpg");

   if (DWObject.ErrorCode != 0)if (DWObject.ErrorCode != 0)
      alert(DWObject.ErrorString);(DWObject.ErrorString);
   else //succeedelse //succeed
     alert("Successful");("Successful");
}}

相关内容推荐:

Dynamic Web TWAIN常见问题(一):如何选择使用哪个版本?
Dynamic Web TWAIN常见问题(二):相比其他的TWAIN SDK,主要优势是什么?
Dynamic Web TWAIN常见问题(三):Dynamic Web TWAIN将使用哪些操作系统?
Dynamic Web TWAIN常见问题(四):编程问题-没有用户界面怎么工作?
Dynamic Web TWAIN常见问题(五):编程问题-如何分别设置水平和垂直分辨率?


想要购买Dynamic Web TWAIN正版授权,或了解更多产品信息请点击


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@capbkgr.cn

文章转载自:

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP