版本支持

Dynamic Web TWAIN各版本v7及以上

语法

Boolean ObjectName.AddText(Short ImageIndex, Int x, Int y, String Text, Int TextColor, Int
BackgroundColor, float BackgroundRoundRadius, float BackgroundOpacity)

参数

  • Short ImageIndex:目标图像索引
  • Int x:文本的X坐标
  • Int y:文本的Y坐标
  • String Text:要添加的文本
  • Int TextColor:文本颜色
  • Int BackgroundColor:背景色
  • float BackgroundRoundRadius:范围是0到0.5;注:Mac版不支持这个参数。
  • float BackgroundOpacity:指定添加文本背景的不透明度,范围是0到1.0;注意:Mac版支持0到1。

返回值

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>