Skip to content

fix(print): improve 58mm browser print & text size - #1493

Merged
khaira777 merged 7 commits into
mainfrom
fm/flocafe-fix-web-print-xp58-legibility
Nov 7, 2026
Merged

khaira777 merged 7 commits into
mainfrom
fm/flocafe-fix-web-print-xp58-legibility

Conversation

@khaira777

@khaira777 khaira777 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1482

Intent

Implement the fix for 58mm/80mm thermal printing legibility (e.g. Xprinter XP-58 SIR where merchants report small, faint item/amount text and dotted borders even after setting Text Size to Extra Large):

  1. Harden thermal58 and thermal80 Browser Print CSS in frontend/src/lib/printer/web-print.ts (and check kot-web-print.ts / order-slip-web-print.ts):
  • Use pure #000 for all text and borders on thermal paper sizes (override #c00, #ccc, #eee, #333, #555, #666, #888) so 203 DPI GDI thermal drivers never halftone-dither text or borders.
  • Increase body/item font size and stroke weight (600/700), and include @page margin rules and safe printable width so Browser Print is crisp and readable on 58mm (48mm printable head) and 80mm thermal printers.
  • Respect the configured printer's text_size (normal | large | extra_large) in web-print.ts (and kot-web-print.ts / order-slip-web-print.ts) as well as in main/routes/printers.ts (printerShape(printer).capabilities.textSize) and frontend/src/hooks/usePrinter.ts (WebUSB and Browser Print).
  1. Clarify the Print Method copy in frontend/src/lib/i18n/messages/en.json (and the other 23 committed locale files) so desktop users with USB/Network thermal printers know to keep ESCPOS selected rather than switching to Browser Print.

What Changed

  • Hardened 58mm and 80mm thermal Browser Print HTML/CSS (web-print.ts, kot-web-print.ts, delivery-slip-web-print.ts, and order-slip-web-print.ts) to use solid #000 text and borders, @page paper sizing with safe printable widths, heavier font weights (600/700), and scaled typography for normal, large, and extra_large printer text sizes.
  • Propagated configured text_size across printerShape()/printerReadinessShape() in main/routes/printers.ts, usePrinterStore (frontend/src/hooks/usePrinter.ts), WebUSB ESC/POS encoders (configureEncoderTextSize and layoutColumnsForTextSize in shared/print/text-size.ts), and WebUSB raster IPC (main/ipc.ts and main/printers/thermal.ts).
  • Updated the Print Method option labels across all 24 locale message files to clarify ESCPOS (USB / Network Thermal Printer) versus Browser Print (any printer), and added unit, E2E, and documentation coverage.

Risk Assessment

✅ Low: The changes are well-bounded to thermal Browser Print legibility (solid #000 colors, @page sizing, and font/weight scaling), end-to-end propagation of per-printer text_size across Browser Print and WebUSB paths while keeping normal output byte-identical, and clarifying Print Method i18n copy across all 24 locales.

Testing

Ran the updated browser receipt visual/computed-style test suite (npm run test:browser-receipts), printer text size and ESC/POS encoding suite (npm run test:printer-text-size), printer API suite (npm run test:printer-api), 58mm/80mm KOT and legibility regression suite (npm run test:issue-1442), delivery slip suite (npm run test:delivery-slip), receipt column oracle (npm run test:receipt-column-oracle), test script coverage (npm run test:script-coverage), translation integrity checks across all 25 locales (npm run i18n:check), documentation checks (npm run docs:check), and the live Playwright E2E suite (frontend/e2e/qa-settings-receipts-printers.spec.ts), capturing HTML and PNG screenshots in the evidence directory; all checks and live scenarios passed.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Merchant configures an XP-58 SIR 58mm printer with Extra Large text size in Settings > Printers, switches Print Method to Browser Print, and prints a bill from /orders; the live Browser Print popup us… ✅ pass live cd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM npx playwright test e2e/qa-settings-receipts-printers.spec.ts --project=chromium; ~
Browser Print receipt, KOT, order slip, and delivery slip HTML generators render normal, large, and extra_large text sizes on 58mm and 80mm thermal paper in headless Chromium with pure #000 computed c… ✅ pass live EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM REQUIRE_VISUAL_EVIDENCE=1 npm run test:browser-receipts; ~/.no-mistakes/evidence/01M6TAY2BFWQ45Q…
Adversarial text_size boundary: POST /api/printers and PUT /api/printers/:id reject invalid text_size values (e.g. 'gigantic') with HTTP 400, while printerShape(printer).capabilities.textSize and fron… ✅ pass live cd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM npx playwright test e2e/qa-settings-receipts-printers.spec.ts --project=chromium; npm run test:printe…
Merchant views Settings > Printers in English and Spanish and sees the clarified Print Method ESCPOS label and guidance ('Direct thermal printing for USB, Network, and WebUSB printers — keep selected… ✅ pass live cd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM npx playwright test e2e/qa-settings-receipts-printers.spec.ts --project=chromium; npm run i18n:check;…

58mm Browser Print receipt rendered at normal text size (13px/600 items, pure #000 contrast)
58mm Browser Print receipt rendered at large text size (15px/700 items, pure #000 contrast)
58mm Browser Print receipt rendered at extra_large text size (17px/700 items, flex-wrapped rows without horizontal overflow)
80mm Browser Print receipt rendered at extra_large text size (18px/700 items, pure #000 contrast)
58mm Browser Print KOT rendered at extra_large text size (16px/700 body, pure #000 borders and text)
58mm Browser Print order slip rendered at extra_large text size (17px/700 body, pure #000 contrast)
Live Settings > Printers UI displaying updated Print Method ESCPOS guidance copy
Live Settings > Printers UI with XP-58 SIR configured at 32 columns and Extra Large text size
Live /orders Browser Print popup rendered for XP-58 SIR at Extra Large text size (58mm, 17px/700 items, #000 contrast)

Evidence: Captured HTML from live /orders Browser Print popup for XP-58 SIR at Extra Large text size
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
  <meta charset="utf-8">
  <title>Bill # INV-20261107-0001</title>
  <style>
    
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body { font-family: -apple-system, 'Segoe UI', Tahoma, 'Noto Naskh Arabic', 'Noto Sans Bengali', 'Vrinda', 'Bangla Sangam MN', 'Noto Sans Devanagari', 'Nirmala UI', 'Kohinoor Devanagari', 'Devanagari Sangam MN', 'Noto Sans Thai', 'Leelawadee UI', Thonburi, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Hiragino Sans', 'Yu Gothic', 'Meiryo', 'Noto Sans CJK JP', 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif; font-size: 13px; font-weight: 600; line-height: 1.4; color: #000; }
    body:lang(zh-TW) { font-family: -apple-system, 'Segoe UI', Tahoma, 'Noto Naskh Arabic', 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans CJK TC', 'Noto Sans TC', 'Helvetica Neue', Arial, sans-serif; }
    .bill-container { max-width: 100%; margin: 0 auto; color: #000; }
    .reprint-banner { text-align: center; font-size: 20px; font-weight: 700; letter-spacing: 2px; color: #000; border: 2px solid #000; padding: 6px; margin-bottom: 12px; }
    .online-order-banner { text-align: center; font-size: 18px; font-weight: 700; letter-spacing: 1px; color: #000; border: 2px solid #000; padding: 6px; margin-bottom: 12px; }
    .online-order-banner .online-order-detail { font-size: 13px; font-weight: 600; letter-spacing: normal; margin-top: 2px; color: #000; }
    .header { text-align: center; margin-bottom: 12px; padding-bottom: 8px; color: #000; border-bottom: 1px solid #000; }
    .receipt-logo { max-width: 80%; max-height: 120px; object-fit: contain; margin: 0 auto 8px auto; display: block; }
    .header h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; color: #000; }
    .bill-details { margin-bottom: 12px; color: #000; }
    .bill-details table { width: 100%; }
    .items-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; color: #000; }
    .items-table th, .items-table td { padding: 6px; border-bottom: 1px solid #000; text-align: start; color: #000; }
    .items-table th { background: transparent; font-weight: 700; color: #000; }
    .tax-table, .payments-table { width: 50%; margin-inline-start: 50%; border-collapse: collapse; margin-bottom: 12px; color: #000; }
    .tax-table th, .tax-table td, .payments-table th, .payments-table td { padding: 4px 6px; color: #000; }
    .tax-table th, .payments-table th { background: transparent; text-align: start; font-weight: 700; color: #000; }
    .totals-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; color: #000; }
    .totals-table td { padding: 4px 6px; color: #000; }
    .total-row { border-top: 2px solid #000; font-size: 16px; font-weight: 700; color: #000; }
    .footer { text-align: center; margin-top: 16px; padding-top: 10px; border-top: 1px solid #000; color: #000; }
    .powered-by { font-size: 11px; font-weight: 600; margin-top: 8px; color: #000; }
    .text-end { text-align: end !important; }
    .num { unicode-bidi: isolate; white-space: nowrap; }
    .ltr { direction: ltr; unicode-bidi: isolate; }
    .text-muted { color: #000; font-weight: 600; }
    .text-italic { font-style: italic; color: #000; font-weight: 600; }
  
        @page { size: 58mm auto; margin: 0; }
        body { color: #000; font-size: 17px; font-weight: 700; width: 58mm; max-width: 58mm; margin: 0 auto; }
        .bill-container { padding: 2mm; width: 100%; max-width: 58mm; font-size: 17px; font-weight: 700; color: #000; }
        .reprint-banner, .online-order-banner { color: #000; border: 2px solid #000; font-size: 20px; font-weight: 700; }
        .header { color: #000; border-bottom: 1px solid #000; }
        .header h1 { font-size: 21px; font-weight: 700; color: #000; }
        .text-muted, .text-italic { color: #000; font-weight: 700; }
        .items-table th, .tax-table th, .payments-table th { background: transparent; color: #000; border-bottom: 1px solid #000; font-weight: 700; }
        .items-table td { color: #000; border-bottom: 1px dashed #000; font-size: 17px; font-weight: 700; }
        .total-row { color: #000; border-top: 2px solid #000; font-size: 19px; font-weight: 700; }
        .footer { color: #000; border-top: 1px solid #000; }
        .powered-by { color: #000; font-size: 13px; font-weight: 600; }
        .tax-table, .payments-table { width: 100%; margin-inline-start: 0; }
        .items-table th, .items-table td, .tax-table td, .totals-table td, .payments-table td { padding: 2px 4px; }
      
        .bill-container { overflow-wrap: anywhere; word-break: break-word; }
        .items-table thead, .items-table tbody { display: block; width: 100%; }
        .items-table thead tr, .items-table tbody tr { display: flex; flex-wrap: wrap; width: 100%; border-bottom: 1px dashed #000; }
        .items-table thead tr { border-bottom: 1px solid #000; }
        .items-table th, .items-table td { border-bottom: none; overflow-wrap: anywhere; word-break: break-word; }
        .items-table th:first-child, .items-table td:first-child { flex: 1 1 100%; width: 100%; max-width: 100%; }
        .items-table th:not(:first-child), .items-table td:not(:first-child) { flex: 1 1 auto; min-width: 0; }
        .items-table td.num { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
      
    @media print {
      .no-print { display: none !important; }
      body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    }
  </style>
</head>
<body>
  <div class="bill-container">
    
    
    <!-- Header -->
    <div class="header">
      
      <h1>Store</h1>
      
      
      
    </div>

    <!-- Bill Details -->
    <div class="bill-details">
      <table>
        <tr>
          <td><strong>Bill #</strong> INV-20261107-0001</td>
          <td class="text-end"><strong>Date</strong> Nov 7, 2569 BE, 02:10 PM</td>
        </tr>
        
        
        
        
        
      </table>
    </div>

    <!-- Items Table -->
    <table class="items-table">
      <thead>
        <tr>
          <th>Item</th>
          <th class="text-end">Qty</th>
          <th class="text-end">Rate</th>
          <th class="text-end">Amount</th>
        </tr>
      </thead>
      <tbody>
        
          <tr>
            <td>
              E2E Coffee
              
              
            </td>
            <td class="text-end num">2</td>
            <td class="text-end num">฿60.00</td>
            <td class="text-end num">฿128.40</td>
          </tr>
        
      </tbody>
    </table>

    <!-- Tax Breakdown -->
    
    <table class="tax-table">
      <thead>
        <tr><th colspan="2">Tax Details</th></tr>
      </thead>
      <tbody>
        
          <tr><td>Tax @7%</td><td class="text-end num">฿8.40</td></tr>
        
      </tbody>
    </table>
    

    <!-- Totals -->
    <table class="totals-table">
      
      
      <tr><td>Subtotal</td><td class="text-end num">฿120.00</td></tr>
      
      
      
      
      
      
      <tr class="total-row"><td><strong>Grand Total</strong></td><td class="text-end num"><strong>฿128.40</strong></td></tr>
      
      
      
    </table>

    <!-- Payments -->
    

    <!-- Footer -->
    <div class="footer">
      <p>Thank you for your visit!</p>
      <p>Tax included where applicable</p>
      <p class="powered-by">Powered by FloPOS (flopos.com)</p>
    </div>
  </div>

  <div class="no-print" style="text-align:center;margin-top:20px;">
    <button onclick="window.print()" style="padding:10px 20px;font-size:16px;cursor:pointer;">Print Bill</button>
  </div>
</body>
</html>
  

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Merchant prints 58mm and 80mm thermal receipts, KOTs, order slips, and delivery slips via Browser Print with Normal, Large, or Extra Large text size and receives pure #000 monochrome styles, bold font… ✅ pass live 10_thermal58_receipt_extra_large.png, 09_thermal58_receipt_large.png, 08_thermal58_receipt_normal.png, 11_thermal80_receipt_extra_large.png, 12_thermal58_kot_extra_large.png, 13_thermal58_order_slip_e…
Merchant configures an XP-58 SIR 58mm printer with Extra Large text size in Settings > Printers, switches Print Method to Browser Print, and prints an order bill from /orders; the API returns capabili… ✅ pass live 15_settings_xp58_extra_large_printer.png, 16_live_orders_browser_print_xp58_xl.png, 16_live_orders_browser_print_xp58_xl.html, and npx playwright test e2e/qa-settings-receipts-printers.spec.ts
WebUSB and ESC/POS thermal encoders respect capabilities.textSize ('normal' | 'large' | 'extra_large') on 58mm and 80mm printers while keeping 'normal' byte-identical to unset ✅ pass live npm run test:printer-text-size, npm run test:printer-api, npm run test:issue-1442, npm run test:delivery-slip, and npm run test:receipt-column-oracle
Merchant views Settings > Printers in English and localized UI (e.g. Spanish) and sees clarified Print Method option labels and hint copy advising USB/Network thermal printer users to keep ESCPOS sele… ✅ pass live 14_settings_print_method_escpos_hint.png, npx playwright test e2e/qa-settings-receipts-printers.spec.ts, and npm run i18n:check
Adversarial guard: submitting an unrecognized text_size value (e.g. 'gigantic') to POST/PUT /api/printers is rejected with HTTP 400, and unrecognized text_size values passed to Browser Print or WebUSB… ✅ pass live npx playwright test e2e/qa-settings-receipts-printers.spec.ts, npm run test:printer-api, and npm run test:browser-receipts
  • EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM REQUIRE_VISUAL_EVIDENCE=1 npm run test:browser-receipts
  • npm run test:printer-text-size
  • npm run test:printer-api
  • npm run test:issue-1442
  • npm run test:delivery-slip
  • npm run test:receipt-column-oracle
  • npm run i18n:check
  • npm run docs:check
  • npm run build && npm run build:frontend && cd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM npx playwright test e2e/qa-settings-receipts-printers.spec.ts --config=playwright.config.ts --project=chromium

✅ No issues found.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Merchant configures an XP-58 SIR 58mm printer with Extra Large text size in Settings > Printers, switches Print Method to Browser Print, and prints a bill from /orders; the live Browser Print popup us… ✅ pass live cd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM npx playwright test e2e/qa-settings-receipts-printers.spec.ts --project=chromium; ~
Browser Print receipt, KOT, order slip, and delivery slip HTML generators render normal, large, and extra_large text sizes on 58mm and 80mm thermal paper in headless Chromium with pure #000 computed c… ✅ pass live EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM REQUIRE_VISUAL_EVIDENCE=1 npm run test:browser-receipts; ~/.no-mistakes/evidence/01M6TAY2BFWQ45Q…
Adversarial text_size boundary: POST /api/printers and PUT /api/printers/:id reject invalid text_size values (e.g. 'gigantic') with HTTP 400, while printerShape(printer).capabilities.textSize and fron… ✅ pass live cd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM npx playwright test e2e/qa-settings-receipts-printers.spec.ts --project=chromium; npm run test:printe…
Merchant views Settings > Printers in English and Spanish and sees the clarified Print Method ESCPOS label and guidance ('Direct thermal printing for USB, Network, and WebUSB printers — keep selected… ✅ pass live cd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM npx playwright test e2e/qa-settings-receipts-printers.spec.ts --project=chromium; npm run i18n:check;…
  • EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM REQUIRE_VISUAL_EVIDENCE=1 npm run test:browser-receipts
  • npm run test:printer-text-size
  • npm run test:printer-api
  • npm run test:issue-1442
  • npm run test:delivery-slip
  • npm run test:receipt-column-oracle
  • npm run test:script-coverage
  • npm run i18n:check
  • npm run docs:check
  • cd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM npx playwright test e2e/qa-settings-receipts-printers.spec.ts --project=chromium
  • git diff --check 461c862abf5102be0fd2585b1c6dd2277cfb7d39
✅ **Document** - passed

✅ No issues found.

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

✅ No issues found.

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Improve thermal browser print legibility and text-size scaling

🐞 Bug fix 📝 Documentation 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Make 58mm and 80mm browser output darker, heavier, and sized for thermal paper.
• Carry printer text-size settings into WebUSB and browser receipt and kitchen-ticket printing.
• Clarify thermal print-method guidance across locales, documentation, and regression tests.
Diagram

graph TD
  Settings["Printer settings"] --> API["Printer API"] --> Store["Printer store"] --> HTML["Thermal HTML"] --> Dialog["Browser print dialog"]
  Store --> USB["WebUSB encoder"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Share thermal typography presets
  • ➕ Keeps size and weight scales consistent across the three HTML renderers.
  • ➕ Reduces duplication when adding another paper size or text-size option.
  • ➖ Requires a shared styling abstraction across renderers with different HTML structures.
  • ➖ Broadens the scope of a targeted legibility fix.

Recommendation: Keep the targeted renderer changes for this fix: receipt, KOT, and order-slip layouts need distinct typography, while the existing text-size normalization provides a common setting. Consider shared presets if their scales need coordinated changes again.

Files changed (36) +1802 / -616

Bug fix (6) +235 / -59
usePrinter.tsCarry active-printer text size into frontend print paths +46/-7

Carry active-printer text size into frontend print paths

• Resolves and normalizes configured text size for browser receipts and KOTs and for WebUSB capabilities used by bills, KOTs, and delivery slips.

frontend/src/hooks/usePrinter.ts

PrinterService.tsStrengthen fallback HTML print typography +5/-3

Strengthen fallback HTML print typography

• Increases the fallback print body's size and weight and forces black text with explicit print color adjustment.

frontend/src/lib/printer/PrinterService.ts

kot-web-print.tsScale thermal KOT typography by printer setting +30/-3

Scale thermal KOT typography by printer setting

• Adds normalized text-size options for both paper widths and renders KOT text and headings with heavier black type.

frontend/src/lib/printer/kot-web-print.ts

order-slip-web-print.tsScale thermal order-slip typography +30/-3

Scale thermal order-slip typography

• Adds text-size options for 58mm and 80mm order-slip fragments and increases black text and heading weights.

frontend/src/lib/printer/order-slip-web-print.ts

web-print.tsMake thermal receipts darker and text-size aware +117/-37

Make thermal receipts darker and text-size aware

• Uses solid black text and borders, explicit zero-margin paper dimensions, and larger, heavier typography for both thermal widths. Scales item, heading, total, and banner text across the three printer text sizes.

frontend/src/lib/printer/web-print.ts

printers.tsExpose text size in printer API capabilities +7/-6

Expose text size in printer API capabilities

• Normalizes each printer's text size once and includes it in both the printer field and its capability object.

main/routes/printers.ts

Tests (4) +1497 / -499
qa-settings-receipts-printers.spec.tsExercise XP-58 settings through a live browser print +366/-37

Exercise XP-58 settings through a live browser print

• Adds an E2E scenario covering English and Spanish guidance, printer API text size, invalid settings, and captured extra-large receipt HTML. It can save optional visual evidence.

frontend/e2e/qa-settings-receipts-printers.spec.ts

browser-receipts.test.tsCover thermal styling and text-size propagation +1087/-445

Cover thermal styling and text-size propagation

• Tests receipt, KOT, and order-slip sizes, black thermal styling, safe normalization, and frontend capability resolution. Adds visual artifacts and Chromium computed-style checks for an extra-large 58mm receipt.

tests/browser-receipts.test.ts

issue-1442-kot-and-58mm-print.test.tsAlign existing thermal assertions with new styles +17/-17

Align existing thermal assertions with new styles

• Updates receipt and order-slip expectations to the larger fonts, heavier weights, and revised thermal padding.

tests/issue-1442-kot-and-58mm-print.test.ts

printer-text-size.test.tsVerify printer API text-size capabilities +27/-0

Verify printer API text-size capabilities

• Checks that printer shaping exposes normalized text size for the default and every configured size.

tests/printer-text-size.test.ts

Documentation (26) +70 / -58
printing.mdDocument frontend text-size propagation +14/-5

Document frontend text-size propagation

• Explains how printer text size reaches WebUSB and browser HTML output, and records the thermal color, paper, and typography rules.

docs/architecture/printing.md

printers.mdClarify print-method and text-size guidance +8/-5

Clarify print-method and text-size guidance

• Directs USB, network, and WebUSB thermal-printer users to ESCPOS and explains how text size affects ESC/POS and Browser Print.

docs/printers.md

ar.jsonClarify Arabic ESCPOS guidance +2/-2

Clarify Arabic ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/ar.json

bn.jsonClarify Bengali ESCPOS guidance +2/-2

Clarify Bengali ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/bn.json

de.jsonClarify German ESCPOS guidance +2/-2

Clarify German ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/de.json

en.jsonClarify English ESCPOS guidance +2/-2

Clarify English ESCPOS guidance

• Replaces WebUSB-only wording with guidance to retain ESCPOS for USB, network, and WebUSB receipt printers.

frontend/src/lib/i18n/messages/en.json

es.jsonClarify Spanish ESCPOS guidance +2/-2

Clarify Spanish ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/es.json

fa.jsonClarify Persian ESCPOS guidance +2/-2

Clarify Persian ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/fa.json

fil.jsonClarify Filipino ESCPOS guidance +2/-2

Clarify Filipino ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/fil.json

fr.jsonClarify French ESCPOS guidance +2/-2

Clarify French ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/fr.json

hi.jsonClarify Hindi ESCPOS guidance +2/-2

Clarify Hindi ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/hi.json

id.jsonClarify Indonesian ESCPOS guidance +2/-2

Clarify Indonesian ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/id.json

it.jsonClarify Italian ESCPOS guidance +2/-2

Clarify Italian ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/it.json

ja.jsonClarify Japanese ESCPOS guidance +2/-2

Clarify Japanese ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/ja.json

ko.jsonClarify Korean ESCPOS guidance +2/-2

Clarify Korean ESCPOS guidance

• Identifies USB and network receipt printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/ko.json

ne.jsonClarify Nepali ESCPOS guidance +2/-2

Clarify Nepali ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/ne.json

nl.jsonClarify Dutch ESCPOS guidance +2/-2

Clarify Dutch ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/nl.json

pt.jsonClarify Portuguese ESCPOS guidance +2/-2

Clarify Portuguese ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/pt.json

ru.jsonClarify Russian ESCPOS guidance +2/-2

Clarify Russian ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/ru.json

sq.jsonClarify Albanian ESCPOS guidance +2/-2

Clarify Albanian ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/sq.json

th.jsonClarify Thai ESCPOS guidance +2/-2

Clarify Thai ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/th.json

tr.jsonClarify Turkish ESCPOS guidance +2/-2

Clarify Turkish ESCPOS guidance

• Names USB and network thermal printers in the label and advises keeping direct thermal printing selected for receipt printers.

frontend/src/lib/i18n/messages/tr.json

ur.jsonClarify Urdu ESCPOS guidance +2/-2

Clarify Urdu ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/ur.json

vi.jsonClarify Vietnamese ESCPOS guidance +2/-2

Clarify Vietnamese ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/vi.json

zh-tw.jsonClarify Traditional Chinese ESCPOS guidance +2/-2

Clarify Traditional Chinese ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/zh-tw.json

zh.jsonClarify Simplified Chinese ESCPOS guidance +2/-2

Clarify Simplified Chinese ESCPOS guidance

• Identifies USB and network thermal printers in the print-method label and includes WebUSB in the selection hint.

frontend/src/lib/i18n/messages/zh.json

@qodo-code-review

qodo-code-review Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. The live test can delete an existing printer 🐞 Bug ☼ Reliability
Description
The new end-to-end test assigns createdPrinterId even when it reused an existing XP-58 printer,
then deletes that ID during cleanup whenever more than one printer exists. On a database already
containing that printer, the test can remove a real configuration; with only one printer, it instead
leaves its changed width, connection type, text size and default status in place.
Code

frontend/e2e/qa-settings-receipts-printers.spec.ts[R385-388]

+      const xp58 = printers.find((p) => p.name === 'XP-58 SIR');
+      expect(xp58).toBeDefined();
+      createdPrinterId = xp58!.id;
+      expect(xp58!.text_size).toBe('extra_large');
Relevance

●●● Strong

Cleanup-safety findings restoring prior printer state without deleting the only default printer were
accepted.

PR-#1046
PR-#1025

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Both the newly created and pre-existing branches converge on the same cleanup ID; cleanup deletes it
based solely on printer count.

frontend/e2e/qa-settings-receipts-printers.spec.ts[343-368]
frontend/e2e/qa-settings-receipts-printers.spec.ts[385-398]
frontend/e2e/qa-settings-receipts-printers.spec.ts[543-555]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Cleanup cannot distinguish a printer created by the test from one that existed before it.
## Fix Focus Areas
- frontend/e2e/qa-settings-receipts-printers.spec.ts[343-368]
- frontend/e2e/qa-settings-receipts-printers.spec.ts[385-398]
- frontend/e2e/qa-settings-receipts-printers.spec.ts[543-555]
## Recommended Fix
Track whether the test actually created the printer; delete only that new record, and snapshot and restore every changed field and the original default when reusing an existing record.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


2. WebUSB receipts ignore the larger text setting ✓ Resolved

Resolving commit: dfec750

Resolution reason
N/A
Description
resolveWebUsbCapabilities supplies textSize to WebUSB printing, but the receipt and kitchen byte
encoders do not consume it, and the raster request does not carry it. When a WebUSB printer is
configured as large or extra large, direct bill and kitchen output remains at its previous size even
though the new documentation says the setting applies.


Remediation recommended

3. Connected WebUSB printers get the wrong size ✓ Resolved

Resolving commit: dfec750

Resolution reason
resolveActivePrinterTextSize was rewritten to prefer the connected WebUSB printer record (when
connected) over defaultPrinter, falling back to the ESC/POS hardware printer and then defaults, and
the explicit override is preserved. Tests assert the connected webusbPrinter's text_size
(extra_large) wins over the default printer's normal size.
Description
resolveActivePrinterTextSize chooses defaultPrinter before webusbPrinter, although the
connected device is matched to a WebUSB printer record independently. If those records differ,
browser bill and kitchen printing uses the default record's size rather than the connected printer's
configured size.

4. Browser delivery slips stay small ✓ Resolved

Resolving commit: dfec750

Resolution reason
N/A
Description
generateOrderSlipHtml now scales its fonts, but the production delivery-slip branch calls the
separate generateDeliverySlipHtml, which still has fixed font sizes and receives no textSize.
Whenever a delivery slip uses Browser Print or its browser fallback, changing the configured printer
size has no effect on that slip.

5. Cashiers still print at normal text size ✓ Resolved

Resolving commit: dfec750

Resolution reason
The readiness shape for print-only users (printerReadinessShape) now includes normalized text_size,
so the frontend's resolveActivePrinterTextSize receives the configured size instead of undefined and
falls back to normal.
Description
resolveActivePrinterTextSize defaults to normal when its printer record has no size, while the
print-only /api/printers response omits both text_size and capabilities. A user with
printing.execute but not printers.manage receives that reduced record, so browser printing
cannot apply a manager's large or extra-large setting.

View medium (2)
6. Large amounts can run off 58mm receipts 🐞 Bug ≡ Correctness
Description
getPaperStyles increases extra-large item text to 17px and weight 700 inside a fixed 58mm page,
while the four-column items table retains nonwrapping quantity, rate and amount cells. A receipt
with sufficiently long currency values can require more than the 54mm available inside the new
padding, pushing receipt content outside the printable width.
Code

frontend/src/lib/printer/web-print.ts[R616-618]

+        @page { size: 58mm auto; margin: 0; }
+        body { color: #000; font-size: ${bodyFontSize}; font-weight: ${bodyWeight}; width: 58mm; max-width: 58mm; margin: 0 auto; }
+        .bill-container { padding: 2mm; width: 100%; max-width: 58mm; font-size: ${bodyFontSize}; font-weight: ${bodyWeight}; color: #000; }
Relevance

●● Moderate

Layout overflow on 58mm is a risky layout concern; accepted width-fitting precedents exist but not
exact.

PR-#676
PR-#1412

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed fixed-width, enlarged layout combines with three nonwrapping numeric cells in every
four-column item row.

frontend/src/lib/printer/web-print.ts[381-417]
frontend/src/lib/printer/web-print.ts[562-574]
frontend/src/lib/printer/web-print.ts[582-587]
frontend/src/lib/printer/web-print.ts[616-629]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Enlarged four-column item rows can exceed the fixed thermal page width.
## Fix Focus Areas
- frontend/src/lib/printer/web-print.ts[381-417]
- frontend/src/lib/printer/web-print.ts[612-629]
## Recommended Fix
Provide a narrow-paper layout that wraps or stacks item and price fields without clipping numeric values; test long localized currency amounts at extra-large size against the 58mm print width.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


7. Delivery-slip status still prints in gray ✓ Resolved

Resolving commit: 71d4d8d

Resolution reason
Delivery-slip payment status boxes were changed from green/amber/gray colored backgrounds and
borders to pure #000 borders, transparent backgrounds, and #000 text, with a root color:#000 and
print-friendly font weights. This removes the colored status styling that the finding flagged.
Description
PrinterService.printViaBrowser now requests exact print-color reproduction but applies its black
override only to the body, not to descendants with inline styles. A delivery slip showing payment
status retains its green, amber or gray text and borders, which a thermal driver's grayscale output
can dither despite the new black body style.

Grey Divider

Context sources
✅ Linked PRs:
  🌐 PR #333
  🌐 PR #555
  🌐 PR #666
❌ Tickets: failed to load — Ticket collection could not establish complete evidence
✅ Compliance rules (platform): 5 rules
✅ Cross-repo context — repo relationships
  Explored: repo: FreeOpenSourcePOS/docs.flopos.com (sha: abe7cff3) — View relationship
Review mode: Auto: ⚖️ Balanced: Cross-cutting print CSS, printer API validation, and WebUSB text-size changes; not clearly extended-dense.

Grey Divider

Tip of the day
💡 Did you know, you can hide the parts of a finding you never read, like the evidence or the agent prompt

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread frontend/src/hooks/usePrinter.ts Resolved
Comment thread frontend/src/hooks/usePrinter.ts Resolved
Comment thread frontend/src/hooks/usePrinter.ts Resolved
Comment thread frontend/src/lib/printer/web-print.ts Resolved
@khaira777 khaira777 changed the title fix: improve 58mm/80mm thermal browser print legibility and text size scaling fix(print): improve 58mm browser print & text size Nov 7, 2026
@khaira777
khaira777 force-pushed the fm/flocafe-fix-web-print-xp58-legibility branch from 58a9adc to dfec750 Compare November 7, 2026 06:49
@khaira777 khaira777 changed the title fix(print): improve 58mm browser print & text size fix(print): improve 58mm/80mm thermal legibility and honor printer text size Nov 7, 2026
Enforce pure #000 text and borders, @page paper dimensions, stronger stroke weights, and printer text_size scaling across 58mm/80mm Browser Print receipts, KOTs, and order slips, include textSize on printer API and WebUSB capabilities, and clarify ESCPOS Print Method copy across all 24 locales.

Fixes #1482
@khaira777
khaira777 force-pushed the fm/flocafe-fix-web-print-xp58-legibility branch from dfec750 to 71d4d8d Compare November 7, 2026 07:19
@khaira777 khaira777 changed the title fix(print): improve 58mm/80mm thermal legibility and honor printer text size fix: harden thermal browser print legibility and honor printer text size Nov 7, 2026
@khaira777 khaira777 changed the title fix: harden thermal browser print legibility and honor printer text size fix(print): improve 58mm browser print & text size Nov 7, 2026
@khaira777
khaira777 enabled auto-merge (squash) November 7, 2026 07:32
@khaira777
khaira777 merged commit 6b1c81d into main Nov 7, 2026
23 checks passed
@khaira777
khaira777 deleted the fm/flocafe-fix-web-print-xp58-legibility branch November 7, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(print): harden 58mm/80mm Browser Print legibility, wire text_size to Browser/WebUSB, and clarify ESCPOS print method copy

1 participant