Centering a receipt title with CPCL Programming(Ze

2019-09-02 15:22发布

问题:

I am producing a receipt with my c# and CPCL code. I've got company name on the top of the receipt.Company name is setup according to who is using that software, I want be able to center that company name. I have tried with command CENTER but its not doing anything I dont know If I am doing something wrong.

My Code is:

SendData = " ! U1 setvar \"device.languages\" \"line_print\"\r\n";
SendData += " ! U SETLP 5 1 46\r\nPAGE-WIDTH 480\r\nSETBOLD 2\r\nPRINT\r\n";          
SendData += " ! U1 CENTER\r\n"+MobileOrdering.AppSettings.Company+"\r\n! U1 SETBOLD 0\r\n";
SendData += " ! U1 CENTER\r\n";
SendData += " ! U1 SETLP 0 2 24";
SendData += MobileOrdering.AppSettings.Address+"\r\n";

Pls help

回答1:

Well as I understood correctly after reading a bit of this manual, you using in line print mode so you can justify just bar codes not text.

(from P9-15)

The BARCODE command is affected by the justification commands like “! U1 CENTER”.

(from P9-18)

The program must set up the file with all the spacing already inserted. Use only spaces, not tab characters, to make things line up correctly

to test if I'am correct try instead of company name add bar code, if it will be centered - I'am right :)

To add centered text you can also try just use commands in label mode:

! 0 200 200 210 1
CENTER
TEXT 4 3 0 0 Centered Company Name
LEFT
TEXT 4 3 0 0 Text on left
FORM
PRINT

Hope that helps.