支持epson esc/pos打印机命令系统。
PyESCPOS的Python项目详细描述
Pyescpos
==
…图片::https://img.shields.io/pypi/status/pyescpos.svg
:目标:https://pypi.python.org/pypi/pyescpos/
:alt:development status
…图片::https://img.shields.io/pypi/pyversions/pyescpos.svg
:目标:https://pypi.python.org/pypi/pyescpos/
:alt:支持的python版本
…图片::https://img.shields.io/pypi/l/pyescpos.svg
:目标:https://pypi.python.org/pypi/pyescpos/
:alt:license
…图片::https://img.shields.io/pypi/v/pyescpos.svg
:目标:https://pypi.python.org/pypi/pyescpos/
:alt:latest version
----
epson copy esc/pos reg兼容打印机的python支持。阅读更多
epson escpos faq`(pdf文档)。
他们的具体工作(在github和许多其他开源存储库上都可以找到)帮助很大。
esc/pos reg是每个制造商都倾向于修改的标准,以满足他们(甚至已经实现)的需要。事实上,没有标准,只有一些尴尬的东西,一种标准的幻觉。从表面上看,人们可以说它几乎是一样的,但是当你看得更深一点时,你很快就会意识到它们几乎完全不同,即使是在属于同一制造商的
型号之间也是一样的。在*销售点*(POS)的
不同打印机(至少是最常见的打印机)中,这些打印机至少基于
esc/pos reg标准,无需修改客户端应用程序代码。要实现这一点,有必要在
所需功能之间设置最小公分母,并提供寻求满足此最小公分母的实现。
硬件:注意|
======================================================================================================================================================================================================
|||||
+————————————————————————————————————————————————————————————————————————————————————————————————————————————|||||
+————————————————————————————————————————————————————————————————————————————||
1.03.24,||
1.03.31
+——————————————————————————————————————————elgin`_|埃尔金I7 1.00.08
|||||
+————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————||||多功能终端型号tmf-101/ig
(cb55-c型号的别名)
+??+??+??+??+??+??+??+??+??+??+??+
未知oem cb55-c 1.3.5|嵌入"Nitere"NPDV-1020(型号:TMF-101/IG)中达鲁玛` DR700 L/H/M和02.51.00,
DR700 L-E/H-E 01.20.00,
01.21.00||
+————————————————————————————————————————————————————————————————————————————|||||
|||||
+————————————————————————————————————————————————————————————————————————————————————————————sourcecode::python
紧急执行器MP4200TH
CB55-C…………escpos.impl.unknown.cb55c
达鲁玛DR700…………Escpos.Impl.Daruma.DR700
Daruma DR800…………Escpos.impl.daruma.dr800
埃尔金i7……………..艾尔金艾尔金尼7
艾尔金尼9……………..艾尔金艾尔金尼9
艾尔金RM-22…………Escpos.impl.elgin.elginrm22
爱普生TM-t20…………escpos.impl.epson.tmt20
一般达鲁马……….esc pos.impl.daruma.darumageric
通用esc/pos……….escpos.impl.epson.genericescpos
通用elgin…………Escpos.impl.elgin.elgingeneric公司escpos.impl.nitere.niterenpdv1020
>用法示例
==
----
>串行通信支持需要"pyserial"版本2.7或更高版本。
sourcecode::python
from escpos import serialconnection
from escpos.impl.epson import genericescpos
n')
printer=genericescpos(conn)
printer.init()
printer.text('hello world!')
网络TCP/IP示例
——
您可以通过网络TCP/IP接口连接到打印机。
……源代码::python
from escpos import networkconnection
from escpos.impl.epson import genericescpos
conn=networkconnection.create('10.0.0.101:9100')
printer=genericescpos(conn)
printer.init()
printer.text('hello world!')
蓝牙示例您的打印机通过蓝牙接口(仅通过RFComm)。
蓝牙支持需要"Pybluez"0.22版。
源代码::python
from escpos import bluetoothconnection
from escpos.impl.epson import genericescpos
=genericescpos(conn)
printer.init()
printer.text('hello world!')
如果事先知道可以在哪个端口进行连接,只需在
设备地址后使用正斜杠传递其编号,例如"00:01:02:03:04:05/4",将连接到"00:01:02:03:04:05"地址上的端口"4"。
尤其是在*nix系统上,这个
非常方便。一个常见的用例是当您拥有并行端口打印机或直接连接到文件系统的任何其他打印机时。请注意,您可能不想使用USB到并行适配器,因为它们非常不可靠,并且会产生许多任意错误。源代码::python
from escpos import fileconnection
from escpos.impl.elgin import elgini9
conn=fileconnection('/dev/usb/lp1')
printer=elgini9(conn)
printer.init()
printer.text('hello world!')
打印(printer.device.output)
虚拟打印示例
----
虚拟打印机主要用于测试和调试目的。它将"输出"的所有
存储为字符串中的原始esc/pos,并返回该值。源代码::python
from escpos import dummyconnection
from escpos.impl.epson import genericescpos
conn=dummyconnection()
printer=genericescpos(conn)
printer.init()
printer.text('hello world!')
打印(printer.device.output)
每个esc/pos
实现都会处理细节,并尽最大努力按您的要求打印您的
条形码。源代码::python
from escpos import barcode
from escpos import serialconnection
from escpos.impl.epson import genericescpos
conn=serialconnection.create('com1:9600,8,1,n')
printer=genericescpos(conn)
printer.init()
printer.code128('0123456789',
条形码高度=96,~12mm(~1/2")
条形码宽度=条形码。条形码宽度为两倍宽度,
barcode_hri=条码。条码底部)
printer.lf()
条码高度=120,~15mm(~9/16",
条码宽度=条码。条码正常宽度,
barcode_hri=barcode.barcode_hri_top)
printer.cut()
条形码数据应完整,包括检查数字和任何其他有效载荷
使该数据对正在处理的符号有效的所需数据。
因此,例如,如果需要打印EAN-13条码,您需要提供
所有13位数字。
与设备的弹性连接。您的应用程序或用户可以通过类似于ini的知名文件格式来配置*backoff*
重试参数:
…sourcecode::ini
[重试]
max-tries=3
延迟=3
因子=2
,其参数为:
*``max-tries````(integer``>;0``)放弃前的重试次数;
*``delay````(integer`>;0```)重试之间的延迟(秒);
*``factor```(integer`>;1```)倍增因子,在下次重试时,延迟将增加
。
通常该文件位于` ~/.escpos/config.cfg``中,但您可以确定
要将该文件放在何处。为此,必须调用"config.configure"函数来指示配置文件的完整路径,例如:
。sourcecode::python
from escpos import config
config.configure(filename='/path/to/config.cfg')
在"pyescpos wiki"页面中。
Declaimer
==
阅读此**Declaimer**非常重要。
本项目中引用的供应商均不同意或认可任何
模式或实现。其名称仅用于维护上下文。
……
sphinx文档:替换位于
http://sphinx doc.org/rest.html;替换位于
http://docutils.sourceforge.net/docutils/parsers/rst/include/isonum.txt
…|复制Unicode::U+00A9..版权标志
:ltrim:
…| REG Unicode::U+00ae..注册标志
:ltrim:
…_` pyescpos wiki`:https://github.com/base4sistemas/pyescpos/wiki
。_` epson escpos常见问题解答`:http://content.epson.de/fileadmin/content/files/rsd/downloads/escpos.pdf
。_` python escpos`:https://github.com/manpaz/python escpos
。_` pyserial`:http://pyserial.sourceforge.net/
。_` pybluez`:http://karulis.github.io/pybluez/
。_`爱普生:http://www.epson.com/
。_` elgin`:http://www.elgin.com.br/
。_` nitere`:http://www.nitere.com.br/
。_` Bematech S/A`:http://www.bematechus.com/
。_` urmet daruma`:http://daruma.com.br/
。_`指数退避:https://en.wikipedia.org/wiki/exponential-backoff
==
…图片::https://img.shields.io/pypi/status/pyescpos.svg
:目标:https://pypi.python.org/pypi/pyescpos/
:alt:development status
…图片::https://img.shields.io/pypi/pyversions/pyescpos.svg
:目标:https://pypi.python.org/pypi/pyescpos/
:alt:支持的python版本
…图片::https://img.shields.io/pypi/l/pyescpos.svg
:目标:https://pypi.python.org/pypi/pyescpos/
:alt:license
…图片::https://img.shields.io/pypi/v/pyescpos.svg
:目标:https://pypi.python.org/pypi/pyescpos/
:alt:latest version
----
epson copy esc/pos reg兼容打印机的python支持。阅读更多
epson escpos faq`(pdf文档)。
他们的具体工作(在github和许多其他开源存储库上都可以找到)帮助很大。
esc/pos reg是每个制造商都倾向于修改的标准,以满足他们(甚至已经实现)的需要。事实上,没有标准,只有一些尴尬的东西,一种标准的幻觉。从表面上看,人们可以说它几乎是一样的,但是当你看得更深一点时,你很快就会意识到它们几乎完全不同,即使是在属于同一制造商的
型号之间也是一样的。在*销售点*(POS)的
不同打印机(至少是最常见的打印机)中,这些打印机至少基于
esc/pos reg标准,无需修改客户端应用程序代码。要实现这一点,有必要在
所需功能之间设置最小公分母,并提供寻求满足此最小公分母的实现。
硬件:注意|
======================================================================================================================================================================================================
|||||
+————————————————————————————————————————————————————————————————————————————————————————————————————————————|||||
+————————————————————————————————————————————————————————————————————————————||
1.03.24,||
1.03.31
+——————————————————————————————————————————elgin`_|埃尔金I7 1.00.08
|||||
+————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————||||多功能终端型号tmf-101/ig
(cb55-c型号的别名)
+??+??+??+??+??+??+??+??+??+??+??+
未知oem cb55-c 1.3.5|嵌入"Nitere"NPDV-1020(型号:TMF-101/IG)中达鲁玛` DR700 L/H/M和02.51.00,
DR700 L-E/H-E 01.20.00,
01.21.00||
+————————————————————————————————————————————————————————————————————————————|||||
|||||
+————————————————————————————————————————————————————————————————————————————————————————————sourcecode::python
紧急执行器MP4200TH
CB55-C…………escpos.impl.unknown.cb55c
达鲁玛DR700…………Escpos.Impl.Daruma.DR700
Daruma DR800…………Escpos.impl.daruma.dr800
埃尔金i7……………..艾尔金艾尔金尼7
艾尔金尼9……………..艾尔金艾尔金尼9
艾尔金RM-22…………Escpos.impl.elgin.elginrm22
爱普生TM-t20…………escpos.impl.epson.tmt20
一般达鲁马……….esc pos.impl.daruma.darumageric
通用esc/pos……….escpos.impl.epson.genericescpos
通用elgin…………Escpos.impl.elgin.elgingeneric公司escpos.impl.nitere.niterenpdv1020
>用法示例
==
>串行通信支持需要"pyserial"版本2.7或更高版本。
sourcecode::python
from escpos import serialconnection
from escpos.impl.epson import genericescpos
n')
printer=genericescpos(conn)
printer.init()
printer.text('hello world!')
网络TCP/IP示例
——
您可以通过网络TCP/IP接口连接到打印机。
……源代码::python
from escpos import networkconnection
from escpos.impl.epson import genericescpos
conn=networkconnection.create('10.0.0.101:9100')
printer=genericescpos(conn)
printer.init()
printer.text('hello world!')
蓝牙示例您的打印机通过蓝牙接口(仅通过RFComm)。
蓝牙支持需要"Pybluez"0.22版。
源代码::python
from escpos import bluetoothconnection
from escpos.impl.epson import genericescpos
=genericescpos(conn)
printer.init()
printer.text('hello world!')
如果事先知道可以在哪个端口进行连接,只需在
设备地址后使用正斜杠传递其编号,例如"00:01:02:03:04:05/4",将连接到"00:01:02:03:04:05"地址上的端口"4"。
尤其是在*nix系统上,这个
非常方便。一个常见的用例是当您拥有并行端口打印机或直接连接到文件系统的任何其他打印机时。请注意,您可能不想使用USB到并行适配器,因为它们非常不可靠,并且会产生许多任意错误。源代码::python
from escpos import fileconnection
from escpos.impl.elgin import elgini9
conn=fileconnection('/dev/usb/lp1')
printer=elgini9(conn)
printer.init()
printer.text('hello world!')
打印(printer.device.output)
虚拟打印示例
----
虚拟打印机主要用于测试和调试目的。它将"输出"的所有
存储为字符串中的原始esc/pos,并返回该值。源代码::python
from escpos import dummyconnection
from escpos.impl.epson import genericescpos
conn=dummyconnection()
printer=genericescpos(conn)
printer.init()
printer.text('hello world!')
打印(printer.device.output)
每个esc/pos
实现都会处理细节,并尽最大努力按您的要求打印您的
条形码。源代码::python
from escpos import barcode
from escpos import serialconnection
from escpos.impl.epson import genericescpos
conn=serialconnection.create('com1:9600,8,1,n')
printer=genericescpos(conn)
printer.init()
printer.code128('0123456789',
条形码高度=96,~12mm(~1/2")
条形码宽度=条形码。条形码宽度为两倍宽度,
barcode_hri=条码。条码底部)
printer.lf()
条码宽度=条码。条码正常宽度,
barcode_hri=barcode.barcode_hri_top)
printer.cut()
条形码数据应完整,包括检查数字和任何其他有效载荷
使该数据对正在处理的符号有效的所需数据。
因此,例如,如果需要打印EAN-13条码,您需要提供
所有13位数字。
与设备的弹性连接。您的应用程序或用户可以通过类似于ini的知名文件格式来配置*backoff*
重试参数:
…sourcecode::ini
[重试]
max-tries=3
延迟=3
因子=2
,其参数为:
*``max-tries````(integer``>;0``)放弃前的重试次数;
*``delay````(integer`>;0```)重试之间的延迟(秒);
*``factor```(integer`>;1```)倍增因子,在下次重试时,延迟将增加
。
通常该文件位于` ~/.escpos/config.cfg``中,但您可以确定
要将该文件放在何处。为此,必须调用"config.configure"函数来指示配置文件的完整路径,例如:
。sourcecode::python
from escpos import config
config.configure(filename='/path/to/config.cfg')
在"pyescpos wiki"页面中。
Declaimer
==
阅读此**Declaimer**非常重要。
本项目中引用的供应商均不同意或认可任何
模式或实现。其名称仅用于维护上下文。
……
sphinx文档:替换位于
http://sphinx doc.org/rest.html;替换位于
http://docutils.sourceforge.net/docutils/parsers/rst/include/isonum.txt
…|复制Unicode::U+00A9..版权标志
:ltrim:
…| REG Unicode::U+00ae..注册标志
:ltrim:
…_` pyescpos wiki`:https://github.com/base4sistemas/pyescpos/wiki
。_` epson escpos常见问题解答`:http://content.epson.de/fileadmin/content/files/rsd/downloads/escpos.pdf
。_` python escpos`:https://github.com/manpaz/python escpos
。_` pyserial`:http://pyserial.sourceforge.net/
。_` pybluez`:http://karulis.github.io/pybluez/
。_`爱普生:http://www.epson.com/
。_` elgin`:http://www.elgin.com.br/
。_` nitere`:http://www.nitere.com.br/
。_` Bematech S/A`:http://www.bematechus.com/
。_` urmet daruma`:http://daruma.com.br/
。_`指数退避:https://en.wikipedia.org/wiki/exponential-backoff