You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Python module for printing on Peripage A6 and A6+
1
+
# peripage-python
2
+
### Python module for printing on Peripage printers
3
3
4
4
**This project is a continued development of the [original project](https://github.com/eliasweingaertner/peripage-A6-bluetooth) made by [Elias Weingärtner](https://github.com/eliasweingaertner). This module combined all results of reverse engineering of the Peripage A6/A6+ protocol in a python utility providing interface and CLI tool for printing on this thermal printer.**
5
5
6
6
## [The original introduction](https://github.com/eliasweingaertner/peripage-A6-bluetooth#introduction)
7
7
8
-
The Peripage A6 F622 is an inexpensive portable thermal printer. It provides both Bluetooth and USB connectivity. Unlike most other thermo printers it **does not** seem to support ESC/POS or any other standardized printer control language.
8
+
The Peripage A6 F622 is an inexpensive portable thermal printer. It provides both Bluetooth and USB connectivity. Unlike most other thermo printers it **does not** seem to support ESC/POS or any other standardized printer control language.
9
9
10
10
So far, the Peripage A6 F622 can be only controlled using a proprietary app (iOS / Anndroid). There is also a driver for Windows with many limitations, most notably the need of defining a page size before printing; this is a huge limitation, as the Peripage prints on continuous form paper.
11
11
12
-
The script provided here was built based on an analysis of captured Bluetooth traffic between the printer and an Android device. The Peripage A6 uses the serial profile (BTSPP) and RFCOMM.
12
+
The script provided here was built based on an analysis of captured Bluetooth traffic between the printer and an Android device. The Peripage A6 uses the serial profile (BTSPP) and RFCOMM.
13
13
14
14
Essentially, the script takes an input images, scales it to the printers native X resolution of 384 pixels, and then sends it to the printer.
15
15
16
-
## Current abilities
16
+
## Deprecation Warning
17
+
18
+
**The latest version ot `ppa6-python` module is deprecated due the major update with new models support and better module naming**
19
+
20
+
## Features
17
21
18
22
* Printing text of any length encoded in ASCII
19
23
* Printing Images using PIL library
20
-
* Printing raw bytes representing image in binary (black/white) form
21
-
* Printing a page break of desired size (in pixels)
22
-
* Printing using generator/iterator which returns image row by row in form of bytes or PIL Images
24
+
* Printing Images row-by row using binary row representation
25
+
* Printing page breaks using paper feed
26
+
* Printing using generator/iterator that return bytes for each row, chunks of bytes for each row, images
23
27
* Requesting printer details (Serial Number, Name, Battery Level, Hardware Info and an option the meaning of which i don't know)
usage: __main__.py [-h] -m MAC [-c [0-2]] [-b [0-255]] -p {A6,A6p,A40} (-t TEXT | -s | -i IMAGE | -q QR | -e)
120
134
121
-
Print on a Peripage A6 / A6+ via bluetooth
135
+
Print on a Peripage printer via bluetooth
122
136
123
137
optional arguments:
124
138
-h, --help show this help message and exit
125
139
-m MAC, --mac MAC Bluetooth MAC address of the printer
126
140
-c [0-2], --concentration [0-2]
127
-
Concentration value for printing (0, 1, 2)
141
+
Concentration value for printing (temperature)
128
142
-b [0-255], --break [0-255]
129
-
Size of the break that should be inserted after the
130
-
print (max 255)
131
-
-p {A6,A6p,A6+}, --printer {A6,A6p,A6+}
132
-
Printer model name (A6 or A6+/A6p (both allowed))
133
-
-n, --newline Force printer to add newline at the end of the printed
134
-
text and flush the buffer
135
-
-t TEXT, --text TEXT ASCII text that should be printed. Add a line break at
136
-
the end of the string to avoid it being cut. String
137
-
can be empty, so just page break will be printed
138
-
-s, --stream Reads an input from stdin and prints as ASCII text
143
+
Size of the break inserted after printed image or text
144
+
-p {A6,A6p,A40}, --printer {A6,A6p,A40}
145
+
Printer model selection
146
+
-t TEXT, --text TEXT ASCII text to print. Text must be ASCII-safe and will be filtered for invalid characters
147
+
-s, --stream Print text received from STDIN, line by line. Text must be ASCII-safe and will be filtered for invalid characters
139
148
-i IMAGE, --image IMAGE
140
-
Path to the image that should be printed
141
-
-q QR, --qr QR String for QR code print
142
-
-e, --introduce Ask the printer to introduce himself
149
+
Path to the image for printing
150
+
-q QR, --qr QR String to convert into a QR code for printing
151
+
-e, --introduce Ask the printer to introduce itself
143
152
```
144
153
145
154
### Print image example
146
155
147
-
**Print image from [file](https://github.com/bitrate16/ppa6-python/blob/main/honk.png) with following break for 100px and concentration set to 2 (HIGH) on A6+**
156
+
**Print image from [file](https://github.com/bitrate16/peripage-python/blob/main/honk.png) with following break for 100px and concentration set to 2 (HIGH) on A6+**
Newline is required to fush the internal printer buffer and force it to print all text without cutting
178
187
179
-
### Suggestions
188
+
## Recommendations
189
+
180
190
* Don't forget about concentration, this can make print brighter and better visible.
181
191
* Split long images into multiple print requests with cooldown time for printer (printer may overheat during a long print and will stop printing for a while. This will result in partial print loss because the internal buffer is about 250px height). For example, when you print [looooooooooooooooooooooooooooooongcat.jpg](http://lurkmore.so/images/9/91/Loooooooooooooooooooooooooooooooooooooooooongcat.JPG), split it into at least 20 pieces with 1-2 minutes delay because you will definetly loose something without cooling. Printer gets hot very fast. Yes, it was the first that i've printed.
182
192
* Be carefull when printing lots of black or using max concentration, as i said, printer heats up very fast.
@@ -186,7 +196,9 @@ Newline is required to fush the internal printer buffer and force it to print al
186
196
187
197
## Code example
188
198
189
-
View this [python notebook](https://github.com/bitrate16/ppa6-python/blob/main/notebooks/ppa6-tutorial.ipynb) for tutorial
199
+
View this [python notebook](https://github.com/bitrate16/peripage-python/blob/main/notebooks/peripage-tutorial.ipynb) for tutorial
200
+
201
+
View this [python notebook](https://github.com/bitrate16/peripage-python/blob/main/notebooks/Test-notebook.ipynb) for test
190
202
191
203
## Printer disassembly
192
204
@@ -196,20 +208,33 @@ View this [python notebook](https://github.com/bitrate16/ppa6-python/blob/main/n
196
208
197
209
* Fix page sometimes get cutted off for some rows
198
210
* Fix delays
199
-
* Python 2.7 support
211
+
*~~Python 2.7 support~~ (Don't need)
200
212
* Implement overheat protection
201
213
* Implement cover open handler
202
-
* Tweak wait timings to precisely match the printing speed
214
+
* Tweak wait timings to precisely match printing speed
203
215
* Implement printer renaming
204
216
* Implement printing stop operation
205
217
* Reverse-engineer USB driver and add support for it
> A: Implement some features and make a pull request in this repo. For example, you could add info about USB communication, write a any-font printing using PIL text drawing, make an additional research in protocol and other cool things.
226
+
227
+
> Q: How to get my printer supported?
228
+
>
229
+
> A: If you own a peripage printer that is currently unsupported, you can reverse-engineer the bluetooth packets captured from the oficial printing app and find out the specs of your printer (the main and the only spec is bytes per row). Another way is to find how many letters can fit in a row when using `printASCII()`.
230
+
>
231
+
> If you would like to participate, please make an issue and I will guide you on how to obtain required parameters.
208
232
209
233
## Credits
210
234
211
235
*[Elias Weingärtner](https://github.com/eliasweingaertner) for initial work in reverse-engineering bluetooth protocol
212
236
*[bitrate16](https://github.com/bitrate16) for additional research and python module
237
+
*[henryleonard](https://github.com/henryleonard) for specs of A40 printer
0 commit comments