Format layout for Zebra printer printing

Asked

Viewed 1,835 times

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?

  • 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.

  • 1

    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.

  • Oops! Did not know the "Print to file", I will do my test the return step!

  • I did this procedure, it even works, however, even formatting, it’s like it prints everything in the same line, very weird.

  • 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, 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 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.

  • 1

    @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!

Show 4 more comments

1 answer

0


Resolved... just change to that way:

                String texto = "! 0 200 200 406 1\r\n"
                        + "TEXT 5 0 40 301 " + notificacaoText.get(0) +"\r\n" //Negrito
                        + "TEXT 5 0 40 240 " + notificacaoText.get(1) +"\r\n" //Negrito
                        + "TEXT 2 0 39 331 " + notificacaoText.get(2) +"\r\n" //AUXILIAR
                        + "TEXT 2 0 39 332 " + notificacaoText.get(3) +"\r\n" //AUXILIAR
                        + "TEXT 2 0 39 333 " + notificacaoText.get(4) +"\r\n" //AUXILIAR
                        + "TEXT 2 0 39 334 " + notificacaoText.get(5) +"\r\n" //AUXILIAR
                        + "TEXT 2 0 39 335 " + notificacaoText.get(6) +"\r\n" //AUXILIAR
                        + "TEXT 2 0 39 336 " + notificacaoText.get(7) +"\r\n" //AUXILIAR
                        + "TEXT 5 0 40 271 " + notificacaoText.get(8) +"\r\n" //Negrito
                        + "TEXT 5 0 40 62 " + notificacaoText.get(9) +"\r\n" //Negrito
                        + "TEXT 5 0 40 210 " + notificacaoText.get(10) +"\r\n" //Negrito
                        + "TEXT 5 0 40 32 " + notificacaoText.get(11) +"\r\n" //Negrito
                        + "FORM\r\n"
                        + "PRINT\r\n";

However, each line has to be formatted for the paper, can not exceed, for example, the 103mm of the sheet q I am using, in Zebradesigner it shows the text in red when I exceed this margin, each TEXT is a line, if I put a paragraph in place of a well-defined line, I will have problems...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.