epson-tm-t20iii #1

Merged
n07070 merged 34 commits from epson-tm-t20iii into master 2022-05-04 11:57:09 +02:00
Showing only changes of commit 6841245187 - Show all commits

View File

@ -1,22 +1,20 @@
# Little Prynter # Little Prynter
--- ---
> Print out shit from the cloud. > Print out shit from the cloud on a thermal paper.
![Ditherd image of a Adafruit Thermal Printer](dither_it_cover.png) ![LittlePrynter Logo](src/static/images/little-printer.png)
[CC-BY oomlout](https://commons.wikimedia.org/wiki/File:TPRI-01_(14335248671).jpg)
## About ## About
This project started when I got a Thermal Printer from a friend. I don't really know if you can do anything more, but I guess it's fun. This project started when I got a Thermal Printer from a friend. It's now evolved to a complete web solution to print out text and images.
## Requirements ## Requirements
To make this project work, you will need : To make this project work, you will need :
- A Thermal Printer : - A Thermal Printer :
- I used Adafruit's thermal printer at first, but it broke down. You can get it [here](https://www.adafruit.com/product/597). - I used *Adafruit's thermal printer* at first, but it broke down. You can get it [here](https://www.adafruit.com/product/597).
- I then used a EPSON TM-T2OIII. It's expensive, but it's also high quality, and has better CUPS and specific library support. - I then used an *EPSON TM-T2OIII*. It's expensive, but it's also high quality, and has better CUPS and specific library support.
- A Raspberry Pi or any computer with USB or Serial. - A Raspberry Pi or any computer with USB or Serial.
- Some electric wires. - Some electric wires.
- Some knowledge of the command line, - Some knowledge of the command line,
@ -24,25 +22,27 @@ To make this project work, you will need :
- 3h of your time, 5h if things need debugging. - 3h of your time, 5h if things need debugging.
- `git`, `virtualenv`,`pip` and `python` >= 3.8.6. - `git`, `virtualenv`,`pip` and `python` >= 3.8.6.
## Installation ## Context
For the EPSON TM-T20III, you can get the CUPS driver from [here](https://download.epson-biz.com/modules/pos/index.php?page=soft&scat=32). It's not specific to the printer I've been using, so you can try with other printers. For the EPSON TM-T20III, you can get the CUPS driver from [here](https://download.epson-biz.com/modules/pos/index.php?page=soft&scat=32). It's not specific to the printer I've been using, so you can try with other printers.
With that, you can try out your printer and print normal text, images or pdf documents for example. LittlePrynter itself does not require any other software than the ones installed with it, i.e the ones listed in the `requirements.txt` file. With that, you can try out your printer and print normal text, images or pdf documents for example. LittlePrynter itself does not require any other software than the ones installed with it, i.e the ones listed in the `requirements.txt` file.
For the Adafruit printer, start by following the guide [here](https://learn.adafruit.com/networked-thermal-printer-using-cups-and-raspberry-pi) to install the CUPS software needed to print images. If you want, you can install it via the command line, [following this guide](https://help.ubuntu.com/lts/serverguide/cups.html). For the Adafruit printer, start by following the guide [here](https://learn.adafruit.com/networked-thermal-printer-using-cups-and-raspberry-pi) to install the CUPS software needed to print images. If you want, you can install it via the command line, [following this guide](https://help.ubuntu.com/lts/serverguide/cups.html).
You can also get some information from [here](https://learn.adafruit.com/mini-thermal-receipt-printer) and [here](https://learn.adafruit.com/instant-camera-using-raspberry-pi-and-thermal-printer) if you're stuck. You can also get some information from [here](https://learn.adafruit.com/mini-thermal-receipt-printer) and [here](https://learn.adafruit.com/instant-camera-using-raspberry-pi-and-thermal-printer) if you're stuck.
Then, setup the project : The version for the EPSON TM-T20III uses a library called `python-escpos`, which doesn't need a CUPS driver or anything else. It's included in the Python dependencies.
The project only supports the EPSON printer, but you can try to adapt it for other printers using the `adafruit-thermal` branch, but I won't offer support for it.
### Install & setup the project :
``` ```
git clone https://git.n07070.xyz/n07070/LittlePrynter $ git clone https://git.n07070.xyz/n07070/LittlePrynter
virtualenv LittlePrynter $ virtualenv LittlePrynter
cd LittlePrynter $ cd LittlePrynter
source bin/activate $ source bin/activate
pip install -r requirements.txt $ pip install -r requirements.txt
``` ```
> tip : when you're done, you can get out of the virtualenv either by closing your terminal, or by running `deactivate`. > tip : when you're done, you can get out of the virtualenv either by closing your terminal, or by running `deactivate`.
@ -52,8 +52,8 @@ You should see a folder named `configuration`. Enter it, and duplicate the file
You can now start the web server with You can now start the web server with
``` ```
export FLASK_APP=main.py $ export FLASK_APP=src/main.py
flask run $ flask run
``` ```
This command should start a web server with which you can test your configuration. If you plan on exposing your printer to the Internet, and give it an IP / URL, _please, please, please_, don't run it this way. Look at Flask's documentation and read about running a production server. It's a little more work, but it will prevent your computer/server being hacked in too easily. This command should start a web server with which you can test your configuration. If you plan on exposing your printer to the Internet, and give it an IP / URL, _please, please, please_, don't run it this way. Look at Flask's documentation and read about running a production server. It's a little more work, but it will prevent your computer/server being hacked in too easily.