1
I was able to print on a Zebra RW 420 printer, but I don’t know how to format the texts, I looked at the documentation to send the data to the printer and noticed the following:
String cpclData = "! 0 200 200 210 1\r\n"
+ "TEXT 4 0 30 40 This is a CPCL test.\r\n"
+ "FORM\r\n"
+ "PRINT\r\n";
This small section leaves the larger text, different font and bold, intended only to leave a margin of the text on the left and right side, because it is very on the margin, and if possible, change the font and break a line, like, divide a paragraph well.
Another thing I noticed, the printing does not accept special characters, type Ç Â Ã and etc, seems to be ASC, I am correct?
I used Zebradesigner2 and did the procedure to get this Script and made my adaptation:
THE DEFAULT:
! 0 200 200 406 1
PW 609
TONE 0
SPEED 3
ON-FEED IGNORE
NO-PACE
BAR-SENSE
PCX 40 102
T 5 0 40 301 Negrito
T 5 0 40 240 Negrito
T 2 0 39 331 AUXILIAR 01
T 2 0 39 331 AUXILIAR 02
T 2 0 39 331 AUXILIAR 03
T 2 0 39 331 AUXILIAR 04
T 5 0 40 271 Negrito
T 5 0 40 62 Negrito
T 5 0 40 210 Negrito
T 5 0 40 32 Negrito
PRINT
And with my formatting:
String texto = "! 0 200 200 406 1\r\n"
+ "PW 609\r\n"
+ "TONE 0\r\n"
+ "SPEED 3\r\n"
+ "ON-FEED IGNORE\r\n"
+ "NO-PACE\r\n"
+ "BAR-SENSE\r\n"
+ "PCX 40 102\r\n"
+ "T 5 0 40 301 " + notificacaoText.get(0) +"\r\n" //Negrito
+ "T 5 0 40 240 " + notificacaoText.get(1) +"\r\n" //Negrito
+ "T 2 0 39 331 " + notificacaoText.get(2) +"\r\n" //AUXILIAR
+ "T 2 0 39 331 " + notificacaoText.get(3) +"\r\n" //AUXILIAR
+ "T 2 0 39 331 " + notificacaoText.get(4) +"\r\n" //AUXILIAR
+ "T 2 0 39 331 " + notificacaoText.get(5) +"\r\n" //AUXILIAR
+ "T 2 0 39 331 " + notificacaoText.get(6) +"\r\n" //AUXILIAR
+ "T 2 0 39 331 " + notificacaoText.get(7) +"\r\n" //AUXILIAR
+ "T 5 0 40 271 " + notificacaoText.get(8) +"\r\n" //Negrito
+ "T 5 0 40 62 " + notificacaoText.get(9) +"\r\n" //Negrito
+ "T 5 0 40 210 " + notificacaoText.get(10) +"\r\n" //Negrito
+ "T 5 0 40 32 " + notificacaoText.get(11) +"\r\n" //Negrito
+ "PRINT\r\n";
However, the following error appears when trying to print:
Could not find class 'com.zebra.sdk.util.internal.StringUtilities$1', referenced from method com.zebra.sdk.util.internal.StringUtilities.convertKeyValueJsonToMap
The problem of the special characters you can solve by uploading a font that supports them, I think has a software of the zebra itself that does this, should be something like "Font Uploader" or "Font Manager". About Zebra Designer, why doesn’t he solve your problem?
– Math
I downloaded yesterday, and from what I noticed I have to format the text there in the software, but I have a very large String, I could not see there, I can be wrong, OBS: The printing is dynamic, the text can change.
– Vinithius
Do the following, mold a label through this Zebra Designer, then at the time of printing choose "Print to file" instead of sending to the printer, so you will have a template of your label, you play it in your code edit as you wish.
– Math
Oops! Did not know the "Print to file", I will do my test the return step!
– Vinithius
I did this procedure, it even works, however, even formatting, it’s like it prints everything in the same line, very weird.
– Vinithius
Solved, I wanted to print a paragraph on the line, but these printers do not interpret this way, they need to be formatted by each line...
– Vinithius
@Vinithius, how did you get this code through Zebradesigner2? I am in the same dilemma of the layout as you were but in my case it is with an image; I have to print a generated bitmap. Back, I can adjust the layout in Zebradesigner and move it to c#?
– kaamis
@kaamis with image I’m still suffering a little, but there is a method in Java that prints images, I do so, first I send the command to print the image and then the text, but it doesn’t always come out the way I want. Now the code I got generating the file in Zebradesigner2 and then Abo in Notepad++, more.
– Vinithius
@Vinithius researched a little more and I managed to get this code generated from Zebradesigner2. I did it by printing as a file and it worked!
– kaamis