Tie printing and frontend together

This commit is contained in:
TT-392 2024-09-15 12:41:12 +02:00
parent 8c48b68f77
commit 30d1cc8e3d
2 changed files with 10 additions and 4 deletions

View file

@ -3,6 +3,8 @@ from PIL import Image
from gen_image import gen_image
from printer_info import *
from datetime import datetime
from print import *
from format_image import *
import os
valid_height=800
@ -126,8 +128,12 @@ def text():
@app.route('/text-print', methods=['GET', 'POST'])
def tex_print():
if request.method == 'POST':
image = format_image("static/text/text.png")
print_image(image)
if 'cut' in request.form:
print("printing and cutting")
cut_paper()
session["cut"] = True;
else:
print("printing")

View file

@ -19,9 +19,9 @@ def print_image(image):
# I'm sorry
os.system("cd epson/; ./print_image.sh /tmp/image.png; cd ..")
image = format_image("static/text/text.png")
image.save("/tmp/image.png")
print_image(image)
cut_paper()
#image = format_image("static/text/text.png")
#image.save("/tmp/image.png")
#print_image(image)
#cut_paper()