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

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.

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.

Related

Prevent ugly kerning when using DrawText

I use simple GDI DrawText to output blocks of text to a printer.
The font used in the sample is Segoe UI. But you can use Arial or others too. It doesn't matter.
The algorithm for large text blocks is simple. DrawText is called with DT_CALCRECT with a kind of binary search for the length to get the largest possible text to print. Than DrawText is called without DT_CALCRECT to print the block.
Simple one line text column text is written with one call to DrawText with the given coordinates of the rectangle.
The result is real strange and can be seen in this sample PDF.
Just look on the first line after the header. You can see the text "Test, Test" and you can see the strange kerning here perfectly. The kerning os sometimes so bad, that you can't even read the words.
How to get around this? Is it a problem with the used printer? Is it a problem with DrawText?
The distance between some chars in a word seem to be random in some case. Some spacing are wide other to narrow. The letter combination looks strange unreadable and ugly.
I tried different fonts and printers but the problem just varies but it is always present.
I know about ExTextOut and the capabilities to define the distance/kerning between all chars, but frankly I don't want to care about this. I just want that DrawText behaves on the printer like on the screen. The stuff works on the screen perfectly.
Added 2018-08-23 08:49 GMT+2*
To the code (it is a complex printing engine).
1.Fonts to print are created simply with CFont::CreatePointFont, so the LOGFONT structure is cleared to zero and no additional flags are used except point and face.
2.The mapping mode is MM_ANISOTROPIC. To scale what is seen on the screen and what is to be printed I just use the size of a komparable object (textblock) on the printer and the same size on the screen. The real values for the sample printout to the Microsoft PDF Printer are as follows, the real way I calculate them is not of interest:
m_pDC->SetMapMode(MM_ANISOTROPIC);
m_pDC->SetViewportExt(2363,100);
m_pDC->SetWindowExt(355,13);
This has the effect that the height of a line in LPs is 13, the average character width in LPs is 6...

ZPL - How can we control width of the barcode in zpl

I am working on conversion of pdf in to ZPL. I am using zebra programming language(zpl).
I am trying to control the barcode(any barcode) width using By command.
^By4 is giving lower width and ^By5 is going out of the box.
My use case is I want to achieve narrow bar width in float number(here 4.5). We can not pass float number in By command.
Please let me know if we can achieve this using some other method in ZPL.
You don't mention what barcode format you're using. Some of them, like 2of5, can also accept the ratio parameter for ^BY. The default is ^BY2,3, changing that to ^BY2,2 can make a smaller version:
^XA
^POI
^CFO,20
^BY5,3
^FO100,400
^BJN,100,Y,N
^FD200940^FS
^BY5,2
^FO100,700
^BJN,100,Y,N
^FD200940^FS
^XZ
This generates two barcodes in 2of5, one with the default ratio and one with a smaller ratio. The second one has a tighter barcode that uses less space. Valid values are 2.0-3.0 (although many round off to the same values) so there is some flexibility. Please note, this only works with barcode formats that are not fixed ratio formats.
You can check the manual page for ^BY in the ZPL programmers guide, p123, for the table that shows valid values and which ones round off to the same value (ie, 2.0 and 2.1 give the same results)

Text is printed incorrectly using ZPL

I print a text using ZPL but they are printed incorrectly. It has gaps in the middle. They are printed correctly to the real printer via the ZebraDesigner. But they are wrong when printing via ZPL:
^FT246,70^A0R,16,16
^FB900,2,,
^FDMaisstaerke, Austernuce, Cashewnuss,Pilz, Mais, Lattich, Pack Choi,Sojasprossen^FS
It is printed as 'Maisstaerke, Austernuce, Cashewnuss,Pilz, Mais, Lattich, Pack Choi, Sojasprossen'
(there is a big gap after 'Mais,').
http://screencast.com/t/sTiaxC3cMg
http://screencast.com/t/0QkypnsPyF89
Please help.
Thanks
I'm unable to reproduce the issue, but the field block width seems rather large; you didn't specify any label dimensions in the original post. If you use the following code--a combination from the original post and your comments:
^XA
^PW560
^LL560
^LS0
^FO246,70^GB28,300,,^FS
^FT246,70^A0R,16,16 ^FB300,2,, ^FDMaisstaerke, Austernuce, Cashewnuss,Pilz, Mais, Lattich, Pack Choi,Sojasprossen^FS
^PQ1,0,1,Y
^XZ
I can reproduce what is possibly the issue--the field block automatic word wrapping--by reducing the field block width to 300 dots.
I also drew a box around the block for visualization. You can test in on the Labelary Viewer.
Finally, if you're somehow composing the data make sure there are no special (non printable, such as tab, non-UTF-8 or accented) characters in it, and if so, you will have to pre-escape them.

ZPL - how can we increase width of ^BC (Code 128) bar code

Am doing a formatting of barcode label.
We are using Zebra Programming Language , ^BC (Code 128) bar code
As i increase the size of ^FD Field Data , the barcode width is increasing.
But how can i print a broader bar code for a fixed small length data.
I saw magnifying factor for some other types like UPC E barcode.
But i dont find any magnifying factor for ^BC code 128 barcode.
I put some space and it increase width but not effective while reading barcode
Look at the ^BY command
^XA
^FO100,100^BY7
^BCN,100,Y,N,N
^FD123456^FS
^XZ
The first parameter is the width of the barocdes after it. The default is 2, range is 1-10
To change the font, size, and placement of the text on the intrepretation line, use the ^A command
^XA
^FO100,100^BY7
^A0N,40,30^BCN,100,Y,N,N
^FD123456^FS
^XZ
I know it's too late to answer your question but I thought it might help others.
I faced the same issue and solved by this trick where I set BC mode to A (for automatic).
example:
^BY3,3,55^FT12,172^BCN,,Y,N,,A
^FD123456789^FS
this resulted a better barcode width for me than when mode is set to its default value.
Note: still you can change BY to suit your needs.
You can refer to the documentation for more information zpl BC command

Changing Font Size of Japanese (Unicode) characters

I have a NSPopUpButton which contains either English or Japanese Strings read from a plist file according to the System's Language. Now when the Language is English I am able to change the font size by using code such as -
[auxStatePopup setFont: [NSFont fontWithName:#"Helvetica-BoldOblique" size:10.0]];
but Using such technique I am not able to change Japanese font size even if I tried by setting some Japanese font name which I googled and found out.
I want to do that because Japanese characters move slightly up when used. I intend to manipulate that upward movement by decreasing font size.
Thanks for any help..
OR
any way to move text in NSPopupButton downwards?
My impression is that the two samples are not using the same font. Please try to put a text with characters from both sets and see what happens.
Also try not to customize the font size and even the font face.
I also suspect that the text rendering engine may had overridden some of your changes due to the text length. iOS text rendering may try to change the font size of letter spacing if the text does not fit the control. So make some tests with shorter texts.
BTW, I think that you were mean to say that you want bigger font size for Japanese not smaller. In the screenshots the Japanese text is already too small to be properly read by anyone.

Resources