Dynamic Web TWAINTWAIN扫描识别工具添加文本到图像
Dynamic Web TWAIN 是应用于Web应用程序的TWAIN扫描识别工具,只需在TWAIN接口写几行代码,就可以用兼容TWAIN的扫描仪扫描文档或从数码相机/采集卡中获取图像,并对采集下来的图像进行处理。
版本支持
Dynamic Web TWAIN各版本v7及以上
语法
Boolean ObjectName.AddText(Short ImageIndex, Int x, Int y, String Text, Int TextColor, Int
BackgroundColor, float BackgroundRoundRadius, float BackgroundOpacity)
参数
返回值
Boolean:True表示成功,FALSE表示失败
标记
IfThrowException属性为True时,发生错误时会抛出一个异常。当返回FALSE或抛出异常时,检查 ErrorCode 属性和ErrorString属性获取错误信息。
示例
下面是一个JavaScript示例:
<script language="javascript"type="text/javascript">
DWObject = document.getElementById("iDynamicWebTwain");//iDynamicWebTwain is the id of the Dynamic Web TWAIN on the page (An object or an embed).
functionbtnAddText_onclick() {
DWObject.AddText(
DWObject.CurrentImageIndexInBuffer,
document.getElementById("addText_Left").value,//Value for setting the x coordinate for the text
document.getElementById("addText_Top").value,//Value for setting the y coordinate for the text
document.getElementById("addText_Text").value,//The text to be added
document.getElementById("addText_TxtColor").value,//The color of the text
document.getElementById("addText_BgColor").value,//The background color of the text
document.getElementById("addText_BGRoundRadius").value,//The value for the background radius
document.getElementById("addText_BGOpacity").value//The value for the background opacity
);
}
</script>