LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

Here is an updated version. I had to modify the top of the label slightly in order to get everything to work. Here is what the label looks like with the changes:

 

Label-1.png

 

I've attached the updated code that will update both the barcode and the text for the serial number. Use this VI directly within your application. Your application will need to keep track of teh serial numbers.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 111 of 165
(9,466 Views)

Dear Mark,

 

 

The only problem is that when I print the label it doesnt show it all:

 

How can i modify the code in order to align the text with the margin?

 

Really appreciate your help!!!

Download All
0 Kudos
Message 112 of 165
(9,440 Views)

Try sending the following to the printer one time.

 

^XA^JUF^XZ

^XA^JUS^XZ

 

That resets the printer to it's default settings. The label you are sending has some other settings which should configure the printer properly. I think you are using a GX430t. Is that correct? What type of media are you using? Id not see the offset that you are seeing when I print it here. Let me know if defaulting the printer works. If not, I will look at it again and give you the settings to move the label over so it prints properly.

 

Mark



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 113 of 165
(9,427 Views)

Dear Mark,

 

I guess that the following lines are the configuration of page and label:

 

CT~~CD,~CC^~CT~
^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR4,4~SD15^JUS^LRN^CI0^XZ

^XA
^FXInitialize printer settings^FS
^MMT
^PW1181
^LL0319
^LS0

 

I tried to replace the second line by: ^XA^JUS^XZ but I get the same exact printing

 

If I replace the second line and the label moves up and moreover it prints 3 blank labels and then it prints out in the 4th label.

 

Also I have tried to remove from line 3 to line 8 and replace it by your two commands but nothing worked.

 

 

Checking over internet I found out that

  • ^PW sets the width
  • ^LL sets the label length
  • ^MMT sensor to look for a gap based label.
  • ^LS set the label shift

I think I finally made it work by changing ^LS and increasing the number:

 

CT~~CD,~CC^~CT~
^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR4,4~SD15^JUS^LRN^CI0^XZ

^XA
^FXInitialize printer settings^FS
^MMT
^PW1181
^LL0319
^LS50

 

 

The real configuration should be:

 

Page:

  • height: 27mm
  • width: 100mm

 

Label:

  • width 88.5
  • height 24mm

 

Maybe you could tell me how to set those parameters correcly but I thought all this should have been already in the code as I configured it correctly on the Zebra Designer.I am also wondering how did you made to work the SN, I think you look for %d and then you place the SN right?

 

You really help me to get this stuff to work properly, really appreciate it.

 

 

 

0 Kudos
Message 114 of 165
(9,406 Views)

Hello Dfrongia,

 

I think Mark meant to send those lines to the printer without anything else to clear the settings.

 

As for formatting everything, have you looked at this: https://www.zebra.com/content/dam/zebra/manuals/en-us/software/zpl-zbi2-pm-en.pdf ?

 

I think that could be helpful for setting up the ZPL commands.

0 Kudos
Message 115 of 165
(9,383 Views)

@gdrag wrote:

Hello Dfrongia,

 

I think Mark meant to send those lines to the printer without anything else to clear the settings.

 

As for formatting everything, have you looked at this: https://www.zebra.com/content/dam/zebra/manuals/en-us/software/zpl-zbi2-pm-en.pdf ?

 

I think that could be helpful for setting up the ZPL commands.


Yes, I did mean to send those lines to the printer only one time. They are simply being used to reset the printer to factory defaults. Thta only needs to be done one time.

 

As Dfrongia discovered the ^LS command is used to shift the label image. While this works it generally should not be needed when designing a lable for a printer which starts in the default state. It is most commonly used when using labels targeted for one printer model on a different model printer. The GX printers are centered justified and the label normally is printed correctly without needing to shift it. However if this works it is a valid solution.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 116 of 165
(9,379 Views)

Hi this is my first post.

 

What I am trying to accomplish is printing a barcode with the MAC address of a board to a 1.0" W x 0.5" H label using a Zebra GX430t printer. Here at my company we are trying to automate this step as previously one of our operators has to do this manually using another software called CodeSoft. The problem I face is that when using the ^BY (Bar Code Field Default) command when using the smallest setting (^BY1), the barcode produced is unreadable for some reason. But when I use the next setting, (^BY2) the barcode is slightly too large for the label. I simply cannot use a larger label as our customer specified this sized label. Also, when using ^BY1, the barcode seems different from when I use ^BY2?  Any suggestions or solutions? My code in LabVIEW is written below:

 

^XA

^FO25,25

^BY1

^BCN,50,Y,N,N,A

^FD (MAC address inputted) ^FS

^XZ

 

0 Kudos
Message 117 of 165
(9,287 Views)

I have not explicitly tried this (just reading the ZPL programming guide):

The first parameter of the ^BY command is essentially the barcode's narrow bar width. You can enter a second parameter to the BY command which controls the ratio of the wide bar to the narrow bar. The accepted values for the ratio are 2.0 to 3.0 in 0.1 increments, with a default of 3.0. The default will produce the widest overall barcode (and easiest to scan). 2.0 would be the narrowest, but also may be more difficult to scan.

 

Try:

^XA

^FO25,25

^BY2,2.0

^BCN,50,Y,N,N,A

^FD (MAC address inputted) ^FS

^XZ

 

If that fits you can increase the value of the 2nd parameter to ^BY (set to 2.0 above) so that it makes it as large as the label will allow (and thus more readable).

 

Alternatively (if you're not locked to that particular type of barcode) use a 2D barcode (such as data matrix). They can be placed on much smaller label sizes (among many other benefits, like data redundancy). Of course that requires your barcode reader to be 2D capable. Older style handheld scanners may be 1D only.

 

Note: The resulting value of the ratio parameter calculation is rounded to a full dot. This means at the smaller narrow bar widths (such as 1 and 2), many of the accepted ratio values will produce the same effective width of the wide bar. So at a narrow bar width of 2, you would only see differences in the wide bar when the ratio values are 2.0, 2.5, and 3.0, etc.

0 Kudos
Message 118 of 165
(9,274 Views)

Thanks for the reply. However I already tried this apporach. I forgot to mention that when I tried ^BY2, the second parameter I used was 2.0  and that's why it was only slightly larger than the label I am using. Also, ya I am locked to using barcode 128.

0 Kudos
Message 119 of 165
(9,269 Views)

Just throwing out ideas, but a higher density (higher resolution) printhead would shrink the sizing of what you could print. May require a different printer...

 

A dot is a dot, unless there are more of them packed into the same inch...

0 Kudos
Message 120 of 165
(9,256 Views)