Solved

print labels to a Zebra printer from my app

Posted on 2014-11-22
7
555 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:SimonAdept
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:SimonAdept
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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:
SimonAdept 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now