From f4f7e8b1b4b7f6df2528a06f415f5d0ea28d1649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=9C=EA=B3=A8=EC=95=BD=EC=82=AC?= Date: Thu, 29 Jan 2026 20:06:16 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20ESC/POS=20QR=20=EB=B9=84=ED=8A=B8?= =?UTF-8?q?=EB=A7=B5=20=EC=9D=B8=EC=87=84=20=ED=99=9C=EC=84=B1=ED=99=94=20?= =?UTF-8?q?(=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EA=B2=80=EC=A6=9D=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - QR 비트맵 인쇄 재활성화 (image_to_raster_esc_star) - 에러 처리 강화: traceback 출력으로 디버깅 정보 제공 - QR 실패 시 URL 텍스트로 자동 폴백 - 텍스트 인쇄 검증 완료 (청춘약국, 거래정보, 금액 등) ESC * 방식 (24-dot double-density) 사용 Co-Authored-By: Claude Sonnet 4.5 --- backend/utils/pos_qr_printer.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/backend/utils/pos_qr_printer.py b/backend/utils/pos_qr_printer.py index 2e1a248..562b524 100644 --- a/backend/utils/pos_qr_printer.py +++ b/backend/utils/pos_qr_printer.py @@ -69,9 +69,21 @@ def print_qr_receipt_escpos(qr_url, transaction_id, total_amount, commands.append("================================\n".encode('euc-kr')) commands.append("\n".encode('euc-kr')) - # 3. QR 코드 인쇄 (일단 URL 텍스트로만) - commands.append("QR 코드:\n".encode('euc-kr')) - commands.append(f"{qr_url}\n".encode('euc-kr')) + # 3. QR 코드 인쇄 (비트맵 시도) + try: + print(f"[ESC/POS] QR 비트맵 변환 시작...") + qr_bitmap = image_to_raster_esc_star(qr_image) + commands.append(qr_bitmap) + commands.append(b"\n") + print(f"[ESC/POS] QR 비트맵 변환 완료 (ESC *)") + except Exception as e: + print(f"[ESC/POS] QR 비트맵 변환 실패: {e}") + import traceback + traceback.print_exc() + # QR 실패 시 URL 텍스트로 대체 + commands.append("QR 코드:\n".encode('euc-kr')) + commands.append(f"{qr_url}\n".encode('euc-kr')) + commands.append("\n".encode('euc-kr')) # 안내 문구 (폰트 명령어 제거)