LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Zebra ZPL codes to printer from Labview

Hello, I just wanted to share how I have managed to print ZPL codes to a Zebra label printer with out using a generic printer driver or setting up a Visa driver.

First of all I installed the driver and label designer software that came with the printer, then went on to printer preferences - advanced setup - other - then checked enable passthrough mode (using start sequence ${ and end sequence }$). I then designed the label template using the label design software that come with the printer, putting in place of the variables the name of that variables eg. serial number, I then printed it to file and changed the file extension to .txt. Than Opened the text file that I had created and added the ${ on the first line and }$ on the end line, Using the file I created the ZPL code was generated for me. Then in Labview I created sub vi's to open the file and Put the text into a string, the in another sub vi searched and replaced the variables that I wanted to change eg. serial number, then saved it back to a new .txt file. Finally I used a sub vi that I found on the sample codes on NI.com using shell32.dll.

For this to work you need the label printed set to default printer on the computer.

Hope this is some help to people.

Message 1 of 12
(12,548 Views)

Sorry Missed out the Shell file and ShellExec Master.vi re-attached.

0 Kudos
Message 2 of 12
(12,524 Views)

I can't see your code to see how you are printing but you can also send the file to the printer using System Exec command.  The printer you want to use has to be shared (not necessarily the default printer). 

 

cmd /c copy %filename% \\%computername%\%printershare%

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 12
(12,495 Views)

Hi chrisneale

Need your help to convert your demo to Labview ver8.2

I cannot open it because your file is a higher version than my Labview.

Thank You

0 Kudos
Message 4 of 12
(12,233 Views)
Use the version conversion board you see linked at the top of the page.
0 Kudos
Message 5 of 12
(12,223 Views)

0 Kudos
Message 6 of 12
(12,210 Views)
Top of the LabVIEW page.
0 Kudos
Message 7 of 12
(12,195 Views)

I've tried this code and your instructions on a GK420t Zebra printer, printing a Datamatrix 2D barcode.  It will not print and I get a notification from Notepad that says "Page too small to print one line.  Try printing using a smaller font."  The file I created in the ZebraDesigner2 software, the barcode prints correctly.  Have you seen this issue?  Do you have any suggestions?

 

Thanks.

0 Kudos
Message 8 of 12
(11,999 Views)

Hi, i had the same problem when first trying to send the code from notepad. The solution i found was to change the page setup settings. In notepad, go to file - page setup - and then change all the margins to 0, then remove the header and footer (if there is one). Make sure that the page orientation if correct for your label setup. the paper size and source should be automatically set via your settings in the zebra printer preferences. The only other thing is to make sure that the start and end commands are on there own lines. for example;

 

${

(ZPL code)

}$

 

Hope this is what you where after.

0 Kudos
Message 9 of 12
(11,984 Views)

Thanks.  Your suggestions worked.  It's printing now with no problems.

0 Kudos
Message 10 of 12
(11,953 Views)