Repository navigation
fix(print): add Z-report raster print fallback - #1491
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoAdd raster fallback to Z-reports and remaining thermal print paths
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
Code Review by Qodo
1.
|
Wire mixed-mode raster rendering and financial-summary semantic line groups into printZReport, printPaymentTicket, and renderTestPage so Turkish and other non-CP437 thermal print jobs rasterize cleanly instead of failing closed with an unsupported financial row refusal. Preserve unrepresentable strings intact in normalizeThermalText when raster is enabled so Turkish labels retain all original glyphs when rasterized, and propagate printer capabilities and financial row flags across WebUSB receipt banners and detailed receipt rows. Fixes #1480
…on-financial raster layouts
…o printing architecture owner
cbf114e to
4548581
Compare
Intent
Check if raster is supported in all the printing done in the app, and if anything is missing or reported as a failure, fix it. Specifically, a user reported an error involving Turkish characters in the text printed on the Z-report even though the system was set up for the Turkish language, with the error message: "Receipt not printed: A financial row contains unsupported printer text (Turkish text). The printer cannot print these characters as text and no image fallback is available on this path. Nothing was printed, so no amount is missing. Try again or use system/browser printing." Fix this and any other print path missing raster support, and ship the PR through no-mistakes.
Fixes #1480
What Changed
financial-summaryline groups across backend thermal Z-report (printZReport), kitchen ticket (printKOTDetailed), delivery slip (printDeliverySlipDetailed), payment ticket (printPaymentTicket), menu print (printMenu), and test page (renderTestPage) flows so non-CP437 characters (such as Turkishı,ğ,ş) render as bitmap bands instead of failing closed on financial rows or dropping glyphs.normalizeThermalTextwhen raster capability is enabled so rasterized labels keep their original glyphs, while retaining native code-page transliteration and safe header fallbacks when raster is disabled or unavailable.receipt-encoder.ts) and KOT (kot-encoder.ts) encoders.Risk Assessment
✅ Low: The changes cleanly wire capability-gated mixed-mode raster rendering and semantic line groups into Z-reports, payment tickets, printer test pages, and WebUSB receipt/KOT encoders while preserving fail-closed financial refusal and printable header fallbacks when raster rendering fails.
Testing
Ran focused raster, receipt-column-oracle, thermal-capabilities, cash-closures, and printer-api test suites, then stood up a live Electron + Express + SQLite instance with a disposable TCP thermal printer socket server to drive Turkish Z-report printing (80mm network and 58mm WebUSB), Turkish payment ticket printing, Turkish printer test pages, adversarial fail-closed raster failures, and real Chromium canvas WebUSB KOT/receipt encoding, capturing decoded ESC/POS visual thermal printout screenshots and JSON transcripts as evidence; all checks and scenarios passed.
Evidence: Live Electron + Express + TCP thermal printer validation report
{ "zReportTurkish": { "network80mm": { "status": 200, "tcpBytesReceived": 42755, "rasterBandCount": 18, "widthDots": 576, "hasDrawerPulse": true }, "webusb58mm": { "status": 200, "webusb": true, "isReprint": true, "bytesLength": 34956, "rasterBandCount": 19, "widthDots": 384, "hasDrawerPulse": true } }, "paymentTicketTurkish": { "network80mm": { "status": 200, "tcpBytesReceived": 9953, "rasterBandCount": 3 }, "webusb58mm": { "status": 200, "webusb": true, "bytesLength": 9889, "rasterBandCount": 3 } }, "printerTestPageTurkish": { "printerByIdWithProbe": { "status": 200, "tcpBytesReceived": 23101, "rasterBandCount": 9 }, "testActive": { "status": 200, "tcpBytesReceived": 14437, "rasterBandCount": 6 } }, "adversarialFailClosed": { "zReportRefusal": { "status": 502, "tcpBytesSent": 0 }, "paymentTicketRefusal": { "status": 502, "tcpBytesSent": 0 } }, "webusbBrowserChromiumCanvas": { "compactReceipt": { "bytesLength": 14326, "rasterBandCount": 7 }, "detailedReceipt": { "bytesLength": 8352, "rasterBandCount": 4 }, "kotTicket": { "bytesLength": 11018, "rasterBandCount": 7 } } }Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
npm run test:rasternpm run test:receipt-column-oraclenpm run test:thermal-capabilitiesnode tests/run-electron-node-test.cjs tests/cash-closures.test.tsnpm run test:printer-apiLive Electron + Express + SQLite + TCP thermal printer validation (POST /api/cash-closures/1/print,POST /api/printers/print-payment-ticket,POST /api/printers/:id/test,POST /api/printers/test-active, and Chromium HTML5 Canvas WebUSB KOT/receipt encoding)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.