Help printing to a Zebra label printer from Tcl or C please

  • Thread starter berkeman
  • Start date
  • Tags
    Printing
In summary, to send a ZPL file to a Zebra label printer, you need to:- Open the Printers folder- Set the desired Zebra printer as the default- Open its status window- Associate LPT1 with the shared printer name- Use the "copy" command to send the text (or ZPL) file to the USB printer in that shared name.
  • #1
berkeman
Mentor
67,061
19,880
TL;DR Summary
I need to print high-resolution graphics agency approval labels and MAC ID labels for a new product's Manufacturing Test Fixture that I'm helping with. My main program and test GUI are in Tcl/Tk, and I have helper programs in C. I'm having trouble understanding the best way to send files to the Zebra printer (ZPL files).
I'm able to send these ZPL files to my 600dpi industrial Zebra printer using their Zebra Setup Utilities program, but I'm not understanding yet how to send the files to the label printer from my Tcl/Tk Mfg test program.

With Google searches, I've found the ezprint option:

http://compgroups.net/comp.lang.tcl/printing-to-a-zebra-label-printer/1858009

but it is too old and it corrupts my Tcl installation and does not work. Ouch.

I've looked at this option recommended by my IT savant:

http://compgroups.net/comp.lang.tcl/printing-to-a-zebra-label-printer/1858009

but so far I'm not understanding the tserialport mechanics and linking it to my Tcl code...

I've tried making the Zebra label printer my Win7 default printer, and sending files via Notepad /P calls, but there are extra things sent with the ZPL file by Notepad or Notepad++ to the printer that seem to confuse it.

I'm thinking that I need to open a Tcl channel to the USB printer with the right syntax, but so far I haven't been able to figure that out. I'm fine with making a C helper app that I call from my Tcl program if that is an easier way to send text files to a printer with no extra information sent along.

Thanks for any ideas!

This is info on a lower-resolution Zebra printer that I'm using for some prototyping:

1590106635663.png
 
Last edited:
Technology news on Phys.org
  • #3
jedishrfu said:
Is there a command that you can use ie not a GUI command ?
Yeah, that's what I was trying to find, so I could call it with the "exec" command from Tcl/Tk. I'd looked at DOS "print..." and "notepad..." commands from the command line, but each had issues with trying to get to a USB device.

Then *finally* after many Google searches, I ended up following a promising rabbit hole of combined search terms, and found a way using "Printer Sharing" to associate one of the old standard printer device names (LPT1) with the USB printer's optional shared resource name.

Here is a link to the page that did it for me ("Solution #2"):

https://www.codeproject.com/Questions/465476/copy-file-to-LP1-printer-using-commandline-in-wind

1590533076502.png

So here is what I did on my Mfg Test laptop (\\loanerx220) to finally be able use "copy" to sent the ZPL files (in /B binary format) to one of my Zebra label printers:

Open the Printers folder and set the desired Zebra printer as the default, then open its status window:

1590533185989.png


Click Printer, Properties, Sharing, “Share this printer” and name automatically gets filled in: ZDesigner 110XiIII Plus 300DPI

but change spaces to “_” to make the contiguous name: ZDesigner_110XiIII_Plus_300DPI

1590533209955.png


Associate LPT1 with that shared printer name…

In a Command Prompt DOS Box:

net use lpt1: \\loanerx220\ZDesigner_110XiIII_Plus_300DPI /persistent:yes

Then to copy a text (or ZPL) file to the USB printer in the shared name, use this (/B means send as binary):

copy /B checks1.zpl LPT1

Where "checks1.zpl" is a small checkerboard pattern file

:smile: And that worked finally! Whew! :smile:
 
Last edited:

What is a Zebra label printer?

A Zebra label printer is a type of printer that is specifically designed for printing labels. It uses thermal printing technology to print on heat-sensitive label materials.

How can I print to a Zebra label printer from Tcl or C?

To print to a Zebra label printer from Tcl or C, you will need to use a specific library or API that is compatible with the printer. Zebra provides a software development kit (SDK) that includes libraries for Tcl and C, allowing you to send print commands to the printer.

Do I need any special software or drivers to print to a Zebra label printer?

Yes, you will need to install the appropriate drivers and software for the Zebra label printer on your computer. This will ensure that your printer is recognized and that you can send print commands to it from Tcl or C.

Can I print different types of labels with a Zebra label printer?

Yes, Zebra label printers are versatile and can print on a variety of label materials, including paper, synthetic materials, and even RFID tags. You can also customize the size and design of your labels using software provided by Zebra.

How do I troubleshoot printing issues with my Zebra label printer?

If you encounter any issues while printing to your Zebra label printer, you can start by checking your connections and ensuring that the printer is properly set up. You can also refer to the Zebra SDK documentation for troubleshooting tips or contact their customer support for further assistance.

Similar threads

  • DIY Projects
Replies
30
Views
4K
  • Programming and Computer Science
Replies
2
Views
30K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Electrical Engineering
Replies
5
Views
2K
  • Computing and Technology
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
Replies
2
Views
5K
Replies
9
Views
3K
Replies
14
Views
3K
  • Special and General Relativity
Replies
13
Views
2K
Back
Top