tools to print to the PeriA6 bluetooth receipt printer
Project description
Peripage A6 F622: Direct printing via Bluetooth
This scripts enables printing on the Peripage A6 F622. We aim mostly at Linux here, but due to the use of Python this script should be portable to any environment supported by PyBluez
Introduction
The Peripage A6 F622 is an inexpensive portable thermo 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.
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.
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.
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.
Please note: This script is mostly a proof of concept. Printing stuff works mostly fine. However, don't expect a polished Python3 library here. Kudos go out to bitrate16 for turning this hack into a proper Python3 library, ppa6!
What is currently working?
- Printing Images (JPG, PNG,...)
- Printing SVG files
- Direct printing of QR codes
- Manipulation of Brightness / Contrast (via Image)
- Toggle Paper feeding
Prerequisites
- Python 3 and PIP
- Peripage A6 printer (obviously)
Install dependencies
This script requires the following dependencies:
- Pybluez (Bluetooth connectivity)
- Pillow (Image handling)
- argparse (Argument parser)
- tqdm (Progress bar)
- qrcode (qr code generation)
- cairosvg (svg rendering)
You can simply install all requirements using PIP:
pip install -r requirements.txt
The next step is to identify the Bluetooth MAC address of your printer. On Linux, this can be easily done using hcitool:
elias@luna:~$ hcitool scan
Scanning ...
B5:5B:13:08:F6:22 PeriPage_F622
elias@luna:~$
Printing Images
Once you know the BT MAC address, printing is straightforward
./ppa6-print.py -i [IMAGE FILE] [BT MAC ADDRESS]
You can use all common raster image formats for printing (PNG, JPG, GIF...)
Example
./ppa6-print.py -i image.jpg B5:5B:13:08:F6:22
Printing SVG files
Similarly, printing SVG files is straightforward. Internally, the image is first rasterized using cairosvg.
Example
./ppa6-print.py --svg myvectorimage.svg B5:5B:13:08:F6:22
Printing QR Codes
For the sake of convenience, the script allows QR codes to be generated and printed directly in one go. Simply pass in in the content for the QR code using the -qroption.
Example
./ppa6-print.py -qr "http://www.weingaertner.org" B5:5B:13:08:F6:22
Manipulating brightness and contrast for printing
In many cases, the print quality dramatically improves if the brightness or the contrast
of the image is adjusted. This can be done using the -b and -b parameters.
Example The example reduces the contrast using a factor of 0.75 and increases the brightness using a factor of 1.5.
./ppa6-print.py -c 0.75 -b 1.5 -i image.jpg B5:5B:13:08:F6:22
Disabling feeding
The script feeds some extra paper after printing to ease cutting. This can be disabled using the -nf parameter.
Example
# no paper feeding
./ppa6-print.py -nf- i image.jpg B5:5B:13:08:F6:22
Status and future work
This script is a proof of concept. The goal was simply to make printing work. There are a lot of unknowns yet with regard to the actual printer communication. Help and PRs are welcome!
Todo:
- Printer scanning & auto-detection
- Text print
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pa6e-0.0.6.tar.gz.
File metadata
- Download URL: pa6e-0.0.6.tar.gz
- Upload date:
- Size: 6.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.30
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07d33dea87fc0643bc31a69d4d73b52c7b65f78602855c1d6429ad025395431f
|
|
| MD5 |
3b29b9c02212b71c9fbabb387def5ff2
|
|
| BLAKE2b-256 |
ae80dd951f558f866e8d00e7b6ee087bd41172e1e4465337c4f764cc8f56b5b0
|
File details
Details for the file pa6e-0.0.6-py3-none-any.whl.
File metadata
- Download URL: pa6e-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.30
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92e6f7b97409baf974c0bf6ee252cde035009aad44da566eaeaa6b077f94ee66
|
|
| MD5 |
a63dc45cc5bab9bb73064f7bdb427cce
|
|
| BLAKE2b-256 |
0da0cf4c8561c69d17d61ef97633d55eba6281d87b88ff399f154ec8fabf7aae
|