Merge pull request 'add-printing' (#1) from add-printing into master
This commit is contained in:
commit
00f562de88
4 changed files with 35 additions and 7 deletions
18
README.md
18
README.md
|
@ -1,7 +1,21 @@
|
|||
### Usage
|
||||
## Usage
|
||||
|
||||
### Generate Address-Label
|
||||
|
||||
```bash
|
||||
echo "Max Hackerberg\nLeibnizstr. 32\n39104 Magdeburg" | python address-label.py
|
||||
|
||||
jq -r .stammdaten.address_label ../Vorstand/stammdaten-formular/example.json | python address-label.py
|
||||
MEMBERFILE="../Vorstand/stammdaten-formular/example.json"
|
||||
jq -r .stammdaten.address_label $MEMBERFILE | python address-label.py
|
||||
```
|
||||
|
||||
### Print label
|
||||
|
||||
Needs to be in the same network as the printer.
|
||||
|
||||
```bash
|
||||
echo "Max Hackerberg\nLeibnizstr. 32\n39104 Magdeburg" | ./address-label.sh
|
||||
|
||||
MEMBERFILE="../Vorstand/stammdaten-formular/example.json"
|
||||
jq -r .stammdaten.address_label $MEMBERFILE | ./address-label.sh
|
||||
```
|
|
@ -3,12 +3,12 @@ import sys
|
|||
|
||||
address = "".join(sys.stdin.readlines())
|
||||
|
||||
img = Image.new('RGB', (696, 160), color = (255, 255, 255))
|
||||
img = Image.new('RGB', (696, 220), color = (255, 255, 255))
|
||||
|
||||
fnt0 = ImageFont.truetype('fonts/OpenSans-Regular.ttf', 14)
|
||||
fnt = ImageFont.truetype('fonts/OpenSans-Regular.ttf', 32)
|
||||
fnt0 = ImageFont.truetype('fonts/OpenSans-Regular.ttf', 24)
|
||||
fnt = ImageFont.truetype('fonts/OpenSans-Regular.ttf', 54)
|
||||
d = ImageDraw.Draw(img)
|
||||
d.text((20,10), "Netz39 e.V., Leibnizstr. 32, 39104 Magdeburg", font=fnt0, fill=(0,0,0))
|
||||
d.text((20,5), "Netz39 e.V., Leibnizstr. 32, 39104 Magdeburg", font=fnt0, fill=(0,0,0))
|
||||
d.text((20,25), address.strip('\"'), font=fnt, fill=(0, 0, 0))
|
||||
|
||||
img.save('pil_text_font.png')
|
||||
img.save('address-label.png')
|
13
address-label.sh
Executable file
13
address-label.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
|
||||
python address-label.py <&0
|
||||
|
||||
export BROTHER_QL_MODEL=QL-720NW
|
||||
export BROTHER_QL_PRINTER=tcp://brw008092c0c4ca
|
||||
|
||||
venv/bin/brother_ql print -l 62 address-label.png
|
||||
|
||||
rm address-label.png
|
|
@ -1 +1,2 @@
|
|||
Pillow==7.1.1
|
||||
brother-ql==0.9.4
|
||||
|
|
Loading…
Reference in a new issue