Solved

print labels to a Zebra printer from my app

Posted on 2014-11-22
7
635 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
Technology Partners: 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 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
MS SQL Update query with connected table data 3 62
Dinamic report to Crosstab query 9 51
How to force output to ascii 2 37
C# DataTable (in memory) vs SQL Lookups 4 35
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

749 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