Skip to content

Commit a394826

Browse files
belonopatkan
andauthored
Docs: profile usage additions and clarifications (python-escpos#677)
* Add link to github * Add profile params to 'Documentation and Usage' * More profile additions and clarifications * Fix code style * Fix Include link to github in documentation topbar * Fix Black code style * Fix GH link * Fix GH link path --------- Co-authored-by: Patrick Kanzler <4189642+patkan@users.noreply.github.com>
1 parent e383b7a commit a394826

3 files changed

Lines changed: 27 additions & 12 deletions

File tree

README.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Another example based on the Network printer class:
5959
6060
from escpos.printer import Network
6161
62-
kitchen = Network("192.168.1.100") #Printer IP Address
62+
kitchen = Network("192.168.1.100", profile="TM-T88III") #Printer IP Address
6363
kitchen.text("Hello World\n")
6464
kitchen.barcode('4006381333931', 'EAN13', 64, 2, '', '')
6565
kitchen.cut()
@@ -71,18 +71,22 @@ Another example based on the Serial printer class:
7171
from escpos.printer import Serial
7272
7373
""" 9600 Baud, 8N1, Flow Control Enabled """
74-
p = Serial(devfile='/dev/tty.usbserial',
75-
baudrate=9600,
76-
bytesize=8,
77-
parity='N',
78-
stopbits=1,
79-
timeout=1.00,
80-
dsrdtr=True)
74+
p = Serial(
75+
devfile='/dev/tty.usbserial',
76+
baudrate=9600,
77+
bytesize=8,
78+
parity='N',
79+
stopbits=1,
80+
timeout=1.00,
81+
dsrdtr=True,
82+
profile="TM-T88III"
83+
)
8184
8285
p.text("Hello World\n")
8386
p.qr("You can readme from your smartphone")
8487
p.cut()
8588
89+
.. note:: It is highly recommended to include a matching profile to inform python-escpos about the printer's capabilities.
8690

8791
The full project-documentation is available on
8892
`Read the Docs <https://python-escpos.readthedocs.io>`_.

doc/conf.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@
143143
# documentation.
144144
# html_theme_options = {}
145145

146+
# Show a 'Edit on GitHub' link instead of 'View page source'
147+
html_context = {
148+
"display_github": True,
149+
"github_user": "python-escpos",
150+
"github_repo": "python-escpos",
151+
"github_version": "master/doc/",
152+
}
153+
146154
# Add any paths that contain custom themes here, relative to this directory.
147155
# html_theme_path = []
148156

doc/user/usage.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Usage
22
=====
33

4-
:Last Reviewed: 2023-08-10
4+
:Last Reviewed: 2025-02-16
55

66
Define your printer
77
-------------------
@@ -113,7 +113,7 @@ on a USB interface.
113113

114114
from escpos import *
115115
""" Seiko Epson Corp. Receipt Printer M129 Definitions (EPSON TM-T88IV) """
116-
p = printer.Usb(0x04b8,0x0202)
116+
p = printer.Usb(0x04b8,0x0202, profile="TM-T88IV")
117117
# Print text
118118
p.text("Hello World\n")
119119
# Print image
@@ -180,13 +180,15 @@ An example file printer::
180180
printer:
181181
type: File
182182
devfile: /dev/someprinter
183+
profile: TM-U220
183184

184185
And for a network printer::
185186

186187
printer:
187188
type: Network
188189
host: 127.0.0.1
189190
port: 9000
191+
profile: TM-U220
190192

191193
An USB-printer could be defined by::
192194

@@ -196,6 +198,7 @@ An USB-printer could be defined by::
196198
idProduct: 0x5678
197199
in_ep: 0x66
198200
out_ep: 0x01
201+
profile: TM-U220
199202

200203
Printing text right
201204
-------------------
@@ -250,8 +253,8 @@ Here you can download an example, that will print a set of common barcodes:
250253

251254
.. _advanced-usage-change-capabilities-profile:
252255

253-
Advanced Usage: change capabilities-profile
254-
-------------------------------------------
256+
Advanced Usage: change where is the capabilities-profile
257+
--------------------------------------------------------
255258

256259
Packaged together with the escpos-code is a capabilities-file. This file in
257260
JSON-format describes the capabilities of different printers. It is developed and hosted in

0 commit comments

Comments
 (0)