Solved

print labels to a Zebra printer from my app

Posted on 2014-11-22
7
597 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
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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 500 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

773 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