fix typos

This commit is contained in:
Thijs Triemstra 2016-12-09 16:56:23 +01:00 committed by GitHub
parent 6158ba344f
commit 24731f433e
1 changed files with 25 additions and 27 deletions

View File

@ -8,12 +8,11 @@ Define your printer
USB printer USB printer
^^^^^^^^^^^ ^^^^^^^^^^^
Before start creating your Python ESC/POS printer instance, you must see Before creating your Python ESC/POS printer instance, consult the system to obtain
at your system for the printer parameters. This is done with the 'lsusb' the printer parameters. This is done with the 'lsusb' command.
command.
First run the command to look for the "Vendor ID" and "Product ID", then Run the command and look for the "Vendor ID" and "Product ID" and write
write down the values, these values are displayed just before the name down the values. These values are displayed just before the name
of the device with the following format: of the device with the following format:
:: ::
@ -37,7 +36,7 @@ so you can get the "Interface" number and "End Point"
# lsusb -vvv -d xxxx:xxxx | grep bEndpointAddress | grep OUT # lsusb -vvv -d xxxx:xxxx | grep bEndpointAddress | grep OUT
bEndpointAddress 0x01 EP 1 OUT bEndpointAddress 0x01 EP 1 OUT
The first command will yields the "Interface" number that must be handy The first command will yield the "Interface" number that must be handy
to have and the second yields the "Output Endpoint" address. to have and the second yields the "Output Endpoint" address.
**USB Printer initialization** **USB Printer initialization**
@ -47,9 +46,9 @@ to have and the second yields the "Output Endpoint" address.
Epson = printer.Usb(0x04b8,0x0202) Epson = printer.Usb(0x04b8,0x0202)
By default the "Interface" number is "0" and the "Output Endpoint" By default the "Interface" number is "0" and the "Output Endpoint"
address is "0x01", if you have other values then you can define with address is "0x01". If you have other values then you can define them on
your instance. So, assuming that we have another printer where in\_ep is your instance. So, assuming that we have another printer where in\_ep is
on 0x81 and out\_ep=0x02, then the printer definition should looks like: on 0x81 and out\_ep=0x02, then the printer definition should look like:
**Generic USB Printer initialization** **Generic USB Printer initialization**
@ -72,10 +71,10 @@ IP by DHCP or you set it manually.
Serial printer Serial printer
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
Must of the default values set by the DIP switches for the serial Most of the default values set by the DIP switches for the serial
printers, have been set as default on the serial printer class, so the printers, have been set as default on the serial printer class, so the
only thing you need to know is which serial port the printer is hooked only thing you need to know is which serial port the printer is connected
up. to.
**Serial printer initialization** **Serial printer initialization**
@ -86,9 +85,9 @@ up.
Other printers Other printers
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
Some printers under /dev can't be used or initialized with any of the Some printers under `/dev` can't be used or initialized with any of the
methods described above. Usually, those are printers used by printcap, methods described above. Usually, those are printers used by printcap,
however, if you know the device name, you could try the initialize however, if you know the device name, you could try to initialize by
passing the device node name. passing the device node name.
:: ::
@ -101,8 +100,8 @@ node, then you don't necessary need to pass the node name.
Define your instance Define your instance
-------------------- --------------------
The following example demonstrate how to initialize the Epson TM-TI88IV The following example demonstrates how to initialize the Epson TM-TI88IV
on USB interface on a USB interface.
:: ::
@ -125,9 +124,9 @@ Configuration File
You can create a configuration file for python-escpos. This will You can create a configuration file for python-escpos. This will
allow you to use the CLI, and skip some setup when using the library allow you to use the CLI, and skip some setup when using the library
programically. programmatically.
The default configuration file is named ``config.yaml``. It's in the YAML The default configuration file is named ``config.yaml`` and uses the YAML
format. For windows it is probably at:: format. For windows it is probably at::
%appdata%/python-escpos/config.yaml %appdata%/python-escpos/config.yaml
@ -143,11 +142,10 @@ If you aren't sure, run::
c.load() c.load()
If it can't find the configuration file in the default location, it will tell If it can't find the configuration file in the default location, it will tell
you where it's looking. You can always pass a path or a list of paths to you where it's looking. You can always pass a path, or a list of paths, to
search to the ``load()`` method. the ``load()`` method.
To load the configured printer, run::
To load the configured pritner, run::
from escpos import config from escpos import config
c = config.Config() c = config.Config()
@ -180,15 +178,15 @@ And for a network printer::
Printing text right Printing text right
------------------- -------------------
Python-escpos is designed to accept unicode. So make sure that you use ``u'strings'`` or import ``unicode_literals`` Python-escpos is designed to accept unicode. So make sure that you use ``u'strings'`` or import ``unicode_literals``
from ``__future__`` if you are on Python2. On Version 3 you should be fine. from ``__future__`` if you are on Python 2. On Python 3 you should be fine.
For normal usage you can simply pass your text to the printers ``text()``-function. It will automatically guess For normal usage you can simply pass your text to the printers ``text()``-function. It will automatically guess
the right codepage and then send the encoded data to the printer. If this feature should not work, please try to the right codepage and then send the encoded data to the printer. If this feature does not work, please try to
isolate the error and then create an issue. isolate the error and then create an issue on the Github project page.
I you want or need to you can manually set the codepage. For this please use the ``charcode()``-function. You can set If you want or need to you can manually set the codepage. For this please use the ``charcode()``-function. You can set
any key-value that is in ``CHARCODE``. If something is wrong, an ``CharCodeError`` will be raised. any key-value that is in ``CHARCODE``. If something is wrong, an ``CharCodeError`` will be raised.
After you have set the codepage manually the printer won't change it anymore. You can get back to normal behaviour After you have manually set the codepage the printer won't change it anymore. You can revert to normal behaviour
by setting charcode to ``AUTO``. by setting charcode to ``AUTO``.
Advanced Usage: Print from binary blob Advanced Usage: Print from binary blob
@ -244,7 +242,7 @@ This is probably best explained by an example:
# send code to printer # send code to printer
p._raw(d.output) p._raw(d.output)
This way you could also store the code in a file and print later. This way you could also store the code in a file and print it later.
You could then for example print the code from another process than your main-program and thus reduce the waiting time. You could then for example print the code from another process than your main-program and thus reduce the waiting time.
(Of course this will not make the printer print faster.) (Of course this will not make the printer print faster.)