作为主题,我有一台POS打印机MatrixPoint MP-3250。 由于手册说它是支持命令:ESC/POS兼容POS打印机MatrixPoint MP-3250 ESC/POS命令
我做搜索谷歌,试过但不会工作。至少设置浓缩字体,粗体,斜体和裁剪纸命令。
运行规格:
- 的Windows 7 32位
- 打印机接口平行槽,我使用BAFO平行 到USB适配器。
- 安装BAFO的驱动程序后,我们得到:USB001 - 虚拟 打印机端口为USB
- 我手动添加打印机“设备和打印机”(添加本地 打印机,设置为USB001端口,并且仅使用通用/文本打印机驱动程序 。
- 我使用WINSPOOL的API(WritePrinter)
- 德尔福XE
请帮助我,任何意见将欣赏发送命令。
我试过用这ESC/POS manual。
编辑。
方法如下:
function WriteToPrinter(const Data: string): DWord;
var Temp: AnsiString;
begin
// write directly to printer device
{ ----
Note:
This method is also able to send Escape command sequences directly,
so you're no longer need to call Win32 API complicated Escape() function.
}
// We need convert to raw string since I'm using Delphi XE
// string = UnicodeString
Temp := AnsiString(Data);
Result := 0;
if (fPrnStatus = rpsPageStarted) then
WritePrinter(fPrnHandle, PAnsiString(Temp), Length(Temp), Result);
end;
WriteToPrinter(#27'@'); // init printer
WriteToPrinter(#27'S'); // normal mode?
WriteToPrinter('Printing to default printer.'); // data
WriteToPrinter('GSV0'); // Cut the paper
我们得到的纸张上打印什么: OWOTOFTPrinting为默认打印机(奇怪的字符出现)
本文未能削减(诺丁山happend)
编辑: 大多数人忘了,上述的东西在爱普生兼容/ IBM 9068A存折打印机(点阵)上工作得很好。 (不确定)打印机直接连接到USB /并行端口,不使用适配器(与现在的USB并行)。
我认为这个适配器或其驱动程序之间存在错误?
谢谢
当您从Windows打印机设置中执行“打印测试页”时,您会得到什么?当你说“不行”时,你试了什么,你期望什么,你得到了什么?你可以展示一些关于如何使用WritePrinter API的代码? – 2011-03-24 07:15:24
@ cosmin-prund是的,我得到正确打印的文本(打印测试页)。好的,发布更新后,请看看。谢谢 – coderbuzz 2011-03-24 07:34:23
尝试使用[Escape](http://msdn.microsoft.com/zh-cn/library/dd162701(v = vs.85).aspx)函数和'PASSTHROUGH'。你的函数中有一个注释,说明'WritePrinter'能够在不使用Escape的情况下向打印机发送转义序列。但是我没有在MSDN页面上看到有关WritePrinter的任何提及,并且您的结果表明转义无法实现。 – 2011-03-24 07:55:48