?
Solved

print labels to a Zebra printer from my app

Posted on 2014-11-22
7
Medium Priority
?
718 Views
Last Modified: 2014-11-25
Hello Experts,
We got this ZEBRA GC420t printer at the office, now we need to print labels from our application.

The printer works just fine with its own software, but we have to type all we need per label each time.

the idea is to put a button in the product window of our app and just by clicking once: the right label with the right data will be printed as many times as specified.

Please all ideas are welcome, if you have source that we can adjust or take as model will be great,

Regards!
0
Comment
Question by:rguillermo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 18

Expert Comment

by:Simon
ID: 40460107
Isn't it just a case of selecting the Zebra printer (if it's not already the default printer) and issuing the print command?

I do have some old VB6 code for printing to Zebra printers that builds the print line by line, but I can't access it until Monday.

Are you printing just text, or barcodes, graphics etc?
0
 

Author Comment

by:rguillermo
ID: 40460224
SimonAdept,
yes if posible please send me one or two examples of that vb6 source
I am willing to print text bar code and graphic all toguether
0
 
LVL 18

Expert Comment

by:Simon
ID: 40460519
OK, but I can't get to it for another 24 hours. Happy for someone else to chip in and answer this if they can do so sooner.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:ktaczala
ID: 40460561
You will need to get the programming manual for the printer. Zebra Printers have their own codes for formatting barcodes, fonts, etc.

I did some years ago with a powerbuilder inventory app.
0
 
LVL 6

Expert Comment

by:tncode
ID: 40460855
A font may be easier to use unless you know the printer's own language. Some companies make barcode fonts that work well on thermal printers at certain point sizes.
0
 
LVL 18

Accepted Solution

by:
Simon earned 2000 total points
ID: 40462076
A lot of the Zebra printers have built-in barcode fonts, not sure about your specific model.

Here is the VB6 code:
Private Sub Form_Load()
For i = 0 To Printers.Count - 1
' if the specified printer is found select it
    If InStr(UCase(Printers(i).DeviceName), "ZEBRA") > 0 Then
        Set Printer = Printers(i)
        SelectPrinter = True
        Exit For
    End If
Next i
If Not SelectPrinter Then
    MsgBox "Unable to find Zebra printer ", vbOKOnly + vbExclamation, " Error"
    End
End If

'Check Code 128 Barcode Font is installed.
Dim bCompare As Boolean
Dim strFont As String

strFont = "Code 128"
For i = 0 To Screen.FontCount - 1
 If Screen.Fonts(i) = "Code 128" Then strScreenFont = "Code 128"
Next

bCompare = StrComp(strFont, strScreenFont, vbTextCompare) = 0

If Not (bCompare) Then
    MsgBox "Barcode font not installed. Reverting to printing non-barcode label.", vbInformation, "Barcode Font Not Installed!"
    bPrintBarcode = False
Else
    'Barcode font installed
    bPrintBarcode = True
End If
End Sub


Snippet from the printing routine that demonstrates switching font from barcode to courier font...

Sub Snippet()

Label_WithBarcode:
        If bPrintBarcode = True Then
            With Printer
            .ScaleMode = vbCentimeters
            .Orientation = 2
            .Font = "Code 128"
            .FontSize = 38
            .FontBold = False
            .FontItalic = False
            .CurrentX = 4.2
            .CurrentY = -0.15
         
            Printer.Print "19293929"
            .Font = "Courier New"
            .FontSize = 11
            .FontBold = True
            .FontItalic = False
            .CurrentX = 0
            .CurrentY = 0.3
            Printer.Print Space(4) & "19293929"

            .CurrentX = 0
            .CurrentY = 1.15
            .FontSize = 15
            Printer.Print Space(1) & StrConv(Surname, vbUpperCase)

            .FontSize = 11
            .CurrentY = 1.6
            Printer.Print Space(17) & StrConv(Forenames, vbUpperCase)
            
            Printer.Print " DofB: " & "13/2/2011" & Space(5) & "Gender : " & "(" & "Male" & ")"

            .FontSize = 5
            Printer.Print Space(1)
            .FontSize = 11

            End If
            .EndDoc
            End With
        End If

End Sub

Open in new window

0
 

Author Closing Comment

by:rguillermo
ID: 40466101
Thanks a lot to all Experts!!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses
Course of the Month12 days, 8 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question