Format layout for printing on Zebra printer
I managed to print on a zebra RW 420 printer, but I do not 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 excerpt leaves the text larger, different font and bold, only intended to leave a margin of the text on the left and right side, because it is very much in the margin, and if possible, change the font and break a line, type, divide a paragraph well.
Something else that I noticed, printing does not accept special characters, Type Ç Â Ã and etc, it seems to be ASC, am I correct?
I used ZebraDesigner2 and did the procedure to take this Script and did my adaptation:
O 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
1 answers
Solved... only change to this 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 paper, it 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...