[SOLVED!] Help printing to a Zebra label printer from Tcl or C please

  • C/++/#
  • Thread starter berkeman
  • Start date
  • #1
berkeman
Mentor
57,447
7,469

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).

Main Question or Discussion Point

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:

Answers and Replies

  • #3
berkeman
Mentor
57,447
7,469
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:

Related Threads on [SOLVED!] Help printing to a Zebra label printer from Tcl or C please

Replies
5
Views
761
Replies
1
Views
889
Replies
9
Views
1K
  • Last Post
Replies
4
Views
2K
Replies
7
Views
125K
Replies
1
Views
11K
Replies
3
Views
566
Replies
3
Views
2K
Top