LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Zebra printer - Printing from LabVIEW using ZPL commands....

Ouch. 

 

So there is no way to use Zebra printers via USB without swapping the NI VISA and Windows drivers every time we want to use the Windows Zebra Designer tool.  I understand from thread that once you use the NI VISA drivers the Windows drivers will no longer work. 

 

There was an older post about using .NET SharedZebra? but there are no examples or details. 

 

Does anyone else have a way to do this?  The serial modules (hardware) that you can plug into a printer for serial access are not available for a few months. 

 

Thanks in advance for any help.  

 

 

 

 

 

0 Kudos
Message 161 of 165
(1,410 Views)

I have used the .net dll with success in LabVIEW. 

The benefit here is that you use the normal Zebra driver, no need for special drivers. 

It will write text directly to the printer. 

 

Link for a LabVIEW talk on using the dll: 
https://github.com/rkone/sharpzebra/issues/3

 

There is a released package her: 
https://www.nuget.org/packages/SharpZebra.rkone/

You can open it as a zip file. 

My basic setup: 

dkfire_0-1676544008213.png

 

Message 162 of 165
(1,382 Views)

Hello, 

 

I found another very simple way that works for me, no need for any special dll, VISA, .NET, etc. 

This sends the full zpl or txt file that contains your commands to the printer by printing from notepad.

Use System_Exec.vi and a command line argument to open notepad, your file, and print it to the generic text printer you created for your printer. Best of all it doesn't interfere with the windows driver so you are free to use ZebraDesigner or any other tool in parallel.  


STEPS: 

1. Create a new generic text printer following these directions. 

https://supportcommunity.zebra.com/s/article/Print-a-zpl-file-using-the-Generic-Text-Printer?languag...


2. Use the System_Exec.vi to send the following command: 

notepad /pt "c:\myfile.txt" "ZD421_text" 

 

Where pt means print to, myfile is the full path to your file that contains the zpl command and ZD421_txt is the name you gave to the generic text printer created in step 1. You must add the quotes. 

ZD421_print.JPG

Hope this helps someone out there. 

 

 

Message 163 of 165
(1,362 Views)

Sergams's approach was helpful to me (thanks!)

 

I didn't love the fact that the notepad GUI briefly pops up even when the "run minimized" option was set to true in the sys exec call or that there was no way to get feedback from the call on whether the operation was successful so did some digging for alternatives.  Found the "print" command works nicely, only slight hitch was that I needed to share out the printer and then use the full network share name with the /D: parameter.

 

Matt_E_0-1719904146303.png

 

So for example, if my computer name was "computer", the printer name was "ZD421-TEXT", and the file to print is c:\temp\label.zpl the command line call is

print /D:"\\computer\ZD421-TEXT" "c:\temp\label.zpl"

Message 164 of 165
(376 Views)

@Matt_E. wrote:

 

So for example, if my computer name was "computer", the printer name was "ZD421-TEXT", and the file to print is c:\temp\label.zpl the command line call is

print /D:"\\computer\ZD421-TEXT" "c:\temp\label.zpl"


If the domain rights are set right that print command works from other computers in the same domain too! That could be handy but also a security concern. Depends on your situation.

Rolf Kalbermatter
My Blog
Message 165 of 165
(372 Views)