我想使用 php 和 LPR 将标签发送到我的 tec 打印机。 一切正常,除了某些部分的对齐。 我的代码/标签是:
{D0478,0600,0400,0640|}
{C|}
{PC01;0040,0135,05,05,J,00,B=Item number: xxxxxx|}
{PC02;0040,0170,05,05,I,00,B= Brand Model ExtraInfo|}
{PC03;0040,0205,05,05,I,00,B=Optional Second Line|}
{PC04;0465,0270,05,05,J,00,B=Eurosign?? Price|}
{PC04;0380,0315,05,05,I,00,B=excl. btw (vat)|}
{XS;I,0001,0002C6101|}
所以 [ESC]PC 的手册是这样说的:
完整手册可在此处找到(内容在第 50-56 页): Manual
[ESC] PCaaa; bbbb, cccc, d, e, ff (,ghh), ii, j (, Jkkll) (, Mm) (, noooooooooo)(, Zpp) (, Pq)(=rrr------rrr) [LF ] [无]
...跳过第一部分...
J:人物属性
B: Black character
W (aabb): Reverse character
aa: No. of dots from the character string to the end
of the black background in the horizontal direction
bb: No. of dots from the character string to the end
of the black background in the vertical direction
aa: 01 to 99 (in units of dots)
bb: 01 to 99 (in units of dots)
F (aabb): Boxed character
aa: No. of dots from the character string area to
the box in the horizontal direction
bb: No. of dots from the character string area to
the box in the vertical direction
aa: 01 to 99 (in units of dots)
bb: 01 to 99 (in units of dots)
C (aa): Stroked out character
aa: No. of dots from the character string area to
the end of the stroke
aa: 01 to 99 (in units of dots)
* Descriptions in parentheses are omissible.
(If omitted, it is character magnification (horizontal or
vertical magnifications, whichever is larger) × 6 dots.)
...再次跳过...
Pq:对齐
(Omissible, When omitted, the alignment is set to left.)
q: Designates the character position
1: Left
2: Center
3: Right
4aaaa: Justification
aaaa: Character string area of X direction
0050 to 1040 (in 0.1 mm units)
5aaaabbbcc: Automatic line feed
aaaa: Character string area of X direction
0050 to 1040 (in 0.1 mm units)
bbb: Line feed spacing
010 to 500 (in 1 mm units)
cc: Number of lines
01 to 99
rrr------rrr: Data string to be printed (Omissible)
Max. 255 digits
完整手册可在此处找到(内容在第 50-56 页): Manual
现在,在所有这些文本之后。我怎样才能正确对齐文本?
作为奖励问题 ;)
如何使用 €(欧元)符号。
手册上说要使用B0H..我试过了,但还没有解决办法。
提前致谢!
最佳答案
默认情况下,€(欧元)符号为 B0H。
要设置 €(euro) 符号,您必须将 B0H 转换为十进制。
在这种情况下 B0H = (char)176.
C# 中的示例:
十进制价格 = 10.00;
SringBuilder sb = new StringBuilder();
sb.Add("{PC04;0465,0270,05,05,J,00,B="+ (char)176 + ""+ price + "|}");
现在,如果您使用 .Net 和 Socket 发送命令,则必须转换 byte[] 中的字符串,并且必须使用以下编码 Encoding.BigEndiangUnicode。然后,例如:
套接字c;
string str = "{PC04;0465,0270,05,05,J,00,B="+ (char)176 + ""+ price + "|}";
byte[] buffer = System.Text.Encoding.BigEndianUnicode.GetBytes(str)
c.Send(buffer);
我希望我说清楚了。
关于php - tpcl(TEC Printer Command Language) [ESC]PC 左对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25290536/