formatting
This commit is contained in:
parent
4648650f86
commit
65235d8c9a
1 changed files with 5 additions and 1 deletions
|
|
@ -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...")
|
print(f"[DEBUG] Attempting to print to {PRINTER_DEVICE} at {PRINTER_BAUDRATE} baud...")
|
||||||
try:
|
try:
|
||||||
printer = escpos.printer.Serial(devfile=PRINTER_DEVICE, baudrate=PRINTER_BAUDRATE, timeout=1)
|
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()
|
printer.cut()
|
||||||
|
|
||||||
print(f"[DEBUG] Print command sent successfully")
|
print(f"[DEBUG] Print command sent successfully")
|
||||||
except Exception as print_err:
|
except Exception as print_err:
|
||||||
print(f"[ERROR] Printer failed: {print_err}")
|
print(f"[ERROR] Printer failed: {print_err}")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue