Search code examples
zebra-printerszplzpl-ii

ZPL command how to reduce a barcode's size of the same ratio?


I would like to reduce my barcode's size but still be the same ratio like picture below.

From

Original Size

To be

Reduced Size

Here is my ZPL code.

^XA
^FO50,20
^BY2,2,20
^BCN,,N,N,N,D
^FDZWW011601512345^FS
^XZ

Please help me how do I deal with it?

Thank you.


Solution

  • This website is great for testing against: http://labelary.com/viewer.html.

    Assuming you don't want the position to move it should just be changing

    ^BY2,2,20
    

    to

    ^BY1,1,10
    

    The API Reference guide can be found https://www.zebra.com/content/dam/zebra/manuals/en-us/software/zpl-zbi2-pm-en.pdf

    Don't forget to take into consideration the print density, i.e. at 152 DPI you probably want something like

    ^FO150,20
    ^BY1,1,10
    

    But at 600 DPI

    ^FO550,80
    ^BY4,1,40
    

    EAN-13 Text Modifications

    If you are using the the inbuilt EAN-13 text function i.e. ^BEN,40,Y,N you can't modify the text. It is to a standard. You can however add your own text e.g.

    ^XA
    ^FO100,20
    ^BEN,40,N,N
    ^FD011601512345^FS
    ^CF0,48
    ^FO90,80^FD011601512345^FS
    ^XZ
    

    ^BEN,40,N,N The first N tells the printer to not generate the number underneath.

    ^CF0,48 Is the select font function of the printer, its first parameter is a default printer font (can be found in the Standard Printer Fonts section of the link above). The second parameter is the font height. If needed there can be a 3rd parameter which alters the font width, though isn't needed.

    ^FO90,80^FD011601512345^FS Sets the field origin of the string starting at the location defined by ^FO. ^FDXXXXXXXX^FS draws the string.