Use barenderin the browser to call the implementation of the active control code of the bar code printer.

Source: Internet
Author: User

Use barenderin the browser to call the implementation of the active control code of the bar code printer.

The system needs to directly call the barcode printer in the browser to print the product barcode.

 

In reality, bar code printers have a wide variety and are difficult to implement in one program. So we use bartender software that already supports all bar code printers.

 

Call its api to print the bar code in the browser.

 

The following is code implementation:

 

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 ("You have not installed barrier. Please click the download link in bar code printing instructions to download and install it. ")
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 ("You have not downloaded the print template. Please click the download link in bar code printing instructions to download and install the template. ")
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

 

 
Bartender bar code printing problems

(The alarm number in this string is not displayed. This problem is actually a functional problem of the scanner. Generally, the scanner can be used. It depends on the brand of the scanner you are using, you can contact your supplier to solve this problem. ) This answer is incomplete. This is just a method (not applicable to general users ).
Step 1: open barriers to create a bar code, double-click to modify the bar code, and select advanced options in the data source options. (122121 #1120001 #0060) Use # as a single source and divide it into three single origins. Create two new screen data in the sub-string example table
(122121) (1120001) (0060) input the three sub-strings respectively into the preceding three groups of characters, and separate each group of characters with a shared name.
Step 2: Select none for bar code visibility in readability (so that you cannot see the number below the bar code) and press OK.
Step 3: create another text. Double-click to modify the text. In the data source options, advanced options, 122121 #1120001 #0060) divide the numbers into five groups of characters (122121 )(#) (1120001) (#) (0060), (122121) (1120001) (0060) the sharing names in the three strings correspond to the sharing names in step 1, and then click OK. In this way, no matter whether you modify the number or the bar code content, you only need to change the corresponding one. In this way, you can also see # but it will not appear in the bar code.

BarTender bar code printer problems

Two problems:
First, there is a problem with the field settings in your database. For example, if you are connecting to an EXCEL table, you need to set the bar code variable to print the content containing letters and numbers. Otherwise, it is not displayed, either print the blank.
Second, is the operating system you are using VISTA or WIN7? If bartender7.75 is used in such an operating system, the problem may occur, because operating systems above VISTA do not support 7.75, and those above 8.0 can.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.