Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing to Zebra Printer with ZPL or Printer Object

Status
Not open for further replies.

UncleCake

Technical User
Feb 4, 2002
355
US
Hi,

I know that this question isn't all VB, but I tried to get some info in the barcode forum, but there isn't any traffic there so I thought I could try here.

For the past 10 or 15 years we have used two Zebra label printers hooked up to a computer via serial port and have sent ZPL to it. We decided to upgrade to newer Zebra printers with network cards so we can print images on the labels, which they have pretty much done what I planned, but I am running into some complications.

With the new printers I used VB6’s printer object and set X and Y coordinates to print my text and bar codes on the labels just like I do with many other documents that I send to HP LaserJets. I am not going to get into the issues that I am having, because I don't think it is relevant (but if you think so I will post it).

My main question is everything I read says to write the txt file and send ZPL to the printer. Why is this used instead of VB6's printer object? I have about 80 users that send print jobs to these printers and wondered if creating a ZPL file was a better way of printing. And, if writing a ZPL text file, where would be a proper place to save the file before it is sent to the printer.

Any input or experience would be greatly appreciated, I am going crazy with this!


-UncleCake
 
UncleCake;

I also use ZEBRA ZPL for print jobs in several applications I maintain. Curretnly, all of the Zebra printers are local, so I do not store them in a file, I fire them off directly to the com port:

Public Sub Pkglabel(xpkgid, xclient, xbox, xboxcnt, xshpwgt, xcompany, xloc As String)

Dim xc20, xc21, xc22, xc23, xc24, xc25, xc26, xc27 As String
Dim retval
'Create the ZPL code for the thermal label.
xc20 = "^XA^PR2^LL800^BY3^LH0,0^FO80,40^BCN,100,N,N,N^FD" & xpkgid & "^FS"
xc21 = "^FO250,160^AEN,45,20^FD" & xpkgid & "^FS"
xc22 = "^FO80,250^AEN,50,25^FDCLIENT> " & xcompany & "^FS"
xc23 = "^FO80,325^AEN,45,20^FDDATE > " & Format(Date, "mm/dd/yyyy") & "^FS"
xc24 = "^FO80,400^AEN,45,20^FDBOX > " & xbox & " of " & xboxcnt & "^FS"
xc25 = "^FO80,475^AEN,45,20^FDWEIGHT> " & xshpwgt & " lbs. " & " LOC> " & xloc & "^FS"
xc26 = "^F30,20^GB750,550,5^FS^FO20,575^AEN,1,1^FDPkg Label^XZ"

'Create a single string for the label output.
xc27 = xc20 & xc21 & xc22 & xc23 & xc24 & xc25 & xc26

'Open the com port
If frmMain.Com1.PortOpen = True Then
frmMain.Com1.PortOpen = False
End If

'Send the label data to the com port.
frmMain.Com1.CommPort = LocalLabelPort
frmMain.Com1.Settings = "9600,E,7,1"
frmMain.Com1.PortOpen = True
frmMain.Com1.Output = xc27
frmMain.Com1.PortOpen = False

End Sub

The reason for using a ZPL print file is that it prints much faster than using a Windows Print Driver, also, you have much more control over the printing.

If you are going to use a file, I would suggest a network file location for one simple reason, if you need to reprint the label, you can do it from anywhere simply by copying the file to the printer itself.

Hope this was helpful.

Jake
 
Jake,

Thanks, I just ran across a code snippet that tells me to change the Data Type on the print driver to text and send it ZPL. I am going to do this to see if this will do it, but thanks for you input.

-UncleCake
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top