formatting

This commit is contained in:
Aron Petau 2025-11-20 12:32:34 +01:00
parent 4648650f86
commit 65235d8c9a

View file

@ -243,8 +243,12 @@ def print_task(request: Request, task_id: str):
print(f"[DEBUG] Attempting to print to {PRINTER_DEVICE} at {PRINTER_BAUDRATE} baud...")
try:
printer = escpos.printer.Serial(devfile=PRINTER_DEVICE, baudrate=PRINTER_BAUDRATE, timeout=1)
printer.text(f"Task: {task.content}\nVon: {task.user}\nPriorität: {task.priority}\n")
# Print the formatted image instead of plain text
printer.image(img)
printer.text("\n\n") # Add some spacing after image
printer.cut()
print(f"[DEBUG] Print command sent successfully")
except Exception as print_err:
print(f"[ERROR] Printer failed: {print_err}")