Star micronics mpop iOS SDK - 使用空白代码页保存并打印一个字符 [英] Star micronics mpop iOS SDK - Save and print a character using the blank code page
问题描述
它似乎总是打印一串字符。下面是我使用的示例代码,仅用于测试,我发送字体A的固体块和字体B的零数据。
[命令appendBytes:
\x1b\x1d\x3d\x00\x30
\xff\x00\xff\x00\xff\ x00 \xff\x00\xff\x00
\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00
\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00
\xff\x00\xff \x00\xff\x00\xff\x00\xff\x00
\xff\x00\xff\x00\xff\x00\xff\ x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\\ \\ x00 \x00\x00\x00\x00\x00\x00\x00
\x00\x00\\ x00 \x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\\ \\ x00 \x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00
\x1b\x1d \x74\xff\x80
length:sizeof(\x1b\x1d\x3d\x00\x30
\xff\x00\xff\\ \\ x00 \xff\x00\xff\x00\xff\x00
\xff\x00\xff\x00\xff\x00\xff\x00 \xff\x00
\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00
\ xff\x00\xff\x00 \\ xff\x00\xff\x00\xff\x00
\xff\x00\xff\x00\xff\x00\xff\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\ x00 \x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\\ \\ x00 \x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00 \x00\x00\x00\x00\x00\x00\x00
\x1b\x1d\x74\xff\x80) - 1];
任何有助于这项工作的帮助将不胜感激。
Esc%= n
来打印字符。 下面的例子会将一个字符保存在空白代码页上的7F位置。这应该在每次应用启动时完成,因为它存储在RAM中,而不是NV。
[commands appendBytes:
\x1b\x26\x01\x01\x7f//将以下内容保存到位置7F
\xff\x00\xff\x00\xff\ x00 \xff\x00\xff\x00
\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00
\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00
\xff\x00\xff \x00\xff\x00\xff\x00\xff\x00
\xff\x00\xff\x00\xff\x00\xff\ x00//字符结尾
\x1b\x25\x01\x7f//打印字符
length:sizeof(\x1b\x26\x01\ x01 \x7f
\xff\x00\xff\x00\xff\x00\xff\x00 \\ xff \x00
\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00
\xff \x00\xff\x00\xff\x00\xff\x00\xff\x00
\xff\x00\xff\x00\xff\ x00 \xff\x00\xff\x00
\xff\x00\xff\x00\xff\x00\xff\x00
\\ \\x1b\x25\x01\x7f) - 1];
在此之后切换回正常的代码页也是一个好主意,否则您将拥有一些奇怪的副作用。这可以使用命令Esc GS t n完成。其中n = 0。
[命令appendBytes:
\x1b\x1d\x74\x00 //切换回正常代码页
length:sizeof(\x1b\x1d\x74\x00) - 1];
I have the star micronics mpop. I have read the documentation (http://www.starmicronics.com/support/mannualfolder/starprnt_cm_en.pdf) Section 2-8 states that you can write to the blank code page. I have followed these instructions but I am still unable to get it to print as intended. I contacted support but they basically told me to use trial and error as they didn't know.
It always seems to prints a string of characters. Below is the sample code I am using, just for testing i'm sending a solid block for font A and zero data for font B.
[commands appendBytes:
"\x1b\x1d\x3d\x00\x30"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x1b\x1d\x74\xff\x80"
length:sizeof("\x1b\x1d\x3d\x00\x30"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x1b\x1d\x74\xff\x80")-1];
Any help to get this working would be greatly appreciated.
I have finally managed to get this to work using the command ESC GS = n1 n2 da1 da2...
to save a character and the command Esc % = n
to print the character.
The example below will save a character to position 7F on the blank code page. This should be done at the start of each app startup as it is stored in RAM, not NV.
[commands appendBytes:
"\x1b\x26\x01\x01\x7f" //Save the following to position 7F
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00" //end of character
"\x1b\x25\x01\x7f" //Print the character
length:sizeof("\x1b\x26\x01\x01\x7f"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
"\xff\x00\xff\x00\xff\x00\xff\x00"
"\x1b\x25\x01\x7f")-1];
It is also a good idea to switch back to the normal code page after this otherwise you will have some weird side effects. This can be done using using the command Esc GS t n. Where n = 0.
[commands appendBytes:
"\x1b\x1d\x74\x00" //Switch back to normal code page
length:sizeof("\x1b\x1d\x74\x00")-1];
这篇关于Star micronics mpop iOS SDK - 使用空白代码页保存并打印一个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!