zoukankan      html  css  js  c++  java
  • 在浏览器中通过bartender,调用条码打印机的active控件代码的实现

     系统中须要在浏览器,直接调用条码打印机,打印出产品条码。

     现实中的条码打印机,品种繁多,非常难在一个程序中实现, 于是我们用已经支持全部条码打印机的bartender软件

    调用它的api ,来实如今浏览器中打印条码。

    以下是 代码实现:

    Private Sub UserControl_Initialize()
    'On Error Resume Next
    Dim app1 As BarTender.Application
        Set app1 = CreateObject("BarTender.Application")
          app1.Quit
         
        
        
         If Err.Number <> 0 Then
            MsgBox ("您还没有安装bartender,请点击《条码打印说明》中的下载链接下载安装。")
         End If
         Err.Clear
        
         'Dim fso As Object
         'Set fso = CreateObject("scripting.filesystemobject")
        
         Dim fso As New Scripting.FileSystemObject
         If fso.FileExists("c:sun.btw") = True Then
            path = "c:sunsky1.btw"
        Else
            If fso.FileExists("d:sun.btw") = True Then
                path = "d:sun.btw"
            Else
                On Error Resume Next
                Err.Clear
               
                DownNetFile "http://www.erwm.org/suns.btw", "c:sun.btw"
                 path = "c:sunsky1.btw"
                If Err.Number <> 0 Then
                Err.Clear
               
                DownNetFile "http://www.erwm.org/sun.btw", "d:sun.btw"
                 path = "d:sunsky1.btw"
                 If Err.Number <> 0 Then
                    MsgBox ("您还没有下载打印模版,请点击《条码打印说明》中的下载链接下载安装。")
                End If
                End If
            End If
        End If
    End Sub

    Public Sub printone(ordernumber As String, itemnumber As String, qty As String, barcode As String, isshow As String)

     
        Dim Format As BarTender.Format
         Set app = CreateObject("BarTender.Application")
        Set Format = app.Formats.Open(path)
     
        Format.SetNamedSubStringValue "barcode", barcode
        Format.SetNamedSubStringValue "ordernumber", ordernumber
        Format.SetNamedSubStringValue "qty", qty
        Format.SetNamedSubStringValue "itemnumber", itemnumber
        If isshow = "1" Then
        Format.PrintOut True, True
        Else
        Format.PrintOut
        End If
        Format.Close btDoNotSaveChanges
         app.Quit
    End Sub


    Public Function isgood() As String
        On Error Resume Next
       
           
        
        
    End Function

    Private Sub DownNetFile(ByVal nUrl As String, ByVal nFile As String)
         Dim XmlHttp, B() As Byte
         Set XmlHttp = CreateObject("Microsoft.XMLHTTP")
         XmlHttp.Open "GET", nUrl, False
         XmlHttp.Send
         If XmlHttp.ReadyState = 4 Then
             B() = XmlHttp.ResponseBody
             Open nFile For Binary As #1
             Put #1, , B()
             Close #1
         End If
         Set XmlHttp = Nothing
    End Sub

     
  • 相关阅读:
    面试题19:包含min函数的栈
    编程之美 计算字符串的相似度
    android 数据持久化——I/O操作
    SSD磁盘,CPU居高不下,高并发的情况下,是不是mysql解析器耗费的cpu资源高?
    Eclipse、MyEclipse优化,提高运行速度
    Sonar入门学习
    Oracle 生成指定范围内随机日期
    ios中的GCD
    如何使用Win8系统自带杀毒软件
    安装Ubuntu版本linux过程中没有提示设置root用户密码问题的解决办法
  • 原文地址:https://www.cnblogs.com/mfrbuaa/p/3924969.html
Copyright © 2011-2022 走看看