From ee5075ea2eb0b2ba69fb6ed7cc3839647b0c024b Mon Sep 17 00:00:00 2001 From: consultoria-as Date: Sat, 18 Jul 2026 17:10:33 +0000 Subject: [PATCH] Increase ticket font sizes and render at real printable width --- pos/static/js/pos.js | 28 +++++++++++++++------------- pos/static/pwa/sw.js | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pos/static/js/pos.js b/pos/static/js/pos.js index d5c45d4..d01fada 100644 --- a/pos/static/js/pos.js +++ b/pos/static/js/pos.js @@ -1663,14 +1663,7 @@ const POS = (() => { if (!src) return; // Paper width: 58 mm -> 48 mm printable; 80 mm -> 72 mm printable. - const paperWidth = parseInt(rc('paper_width', '80'), 10) || 80; - const is58 = paperWidth === 58; - // Lower virtual resolution: render on a narrower canvas so the printer - // driver scales content up, producing thicker/larger pixels. - const printWidth = is58 ? 42 : 64; - const fontSize = is58 ? '9pt' : '10.5pt'; - const smallFont = is58 ? '7.5pt' : '9pt'; - const nameMax = is58 ? '14mm' : '27mm'; + let iframe = document.getElementById('ticketPrintFrame'); if (!iframe) { @@ -1684,6 +1677,14 @@ const POS = (() => { document.body.appendChild(iframe); } + const paperWidth = parseInt(rc('paper_width', '80'), 10) || 80; + const is58 = paperWidth === 58; + // Render at the real printable width so text is not scaled down by the driver. + const printWidth = is58 ? 48 : 72; + const fontSize = is58 ? '12pt' : '14pt'; + const smallFont = is58 ? '10pt' : '12pt'; + const nameMax = is58 ? '20mm' : '38mm'; + const doc = iframe.contentDocument || iframe.contentWindow.document; doc.open(); doc.write(` @@ -1695,14 +1696,15 @@ const POS = (() => { * { box-sizing: border-box; } html, body { margin: 0; padding: 0; height: auto; overflow: visible; background: #fff; color: #000; font-family: 'Courier New', Courier, 'Lucida Console', monospace; font-size: ${fontSize}; line-height: 1.55; -webkit-font-smoothing: none; -moz-osx-font-smoothing: unset; text-rendering: geometricPrecision; image-rendering: pixelated; } body { width: ${printWidth}mm; } - .ticket { width: ${printWidth}mm; padding: 4mm 3mm 5mm; border: none !important; box-shadow: none !important; } - .item-line-wide { display: grid !important; grid-template-columns: 8mm 1fr auto auto !important; gap: 2mm; font-size: ${fontSize}; margin-bottom: 2mm; padding-left: 1mm; align-items: start; } + .ticket { width: ${printWidth}mm; padding: 3mm 2.5mm 4mm; border: none !important; box-shadow: none !important; } + .item-line-wide { display: grid !important; grid-template-columns: ${is58 ? '9mm 1fr auto' : '10mm 1fr auto auto'} !important; gap: 2mm; font-size: ${fontSize}; margin-bottom: 2.5mm; padding-left: 1mm; align-items: start; } .item-line-wide .qty { text-align: center; } .item-line-wide .name { white-space: normal !important; word-break: break-word; overflow-wrap: anywhere; max-width: ${nameMax}; padding-left: 1mm; } - .item-line-wide .price, .item-line-wide .subtotal { text-align: right; white-space: nowrap; } + .item-line-wide .price { text-align: right; white-space: nowrap; ${is58 ? 'display: none !important;' : ''} } + .item-line-wide .subtotal { text-align: right; white-space: nowrap; } .ticket-row, .folio-line, .total-line { display: flex !important; justify-content: space-between; gap: 2mm; } - .total-line.grand { font-size: ${is58 ? '11pt' : '13pt'}; font-weight: bold; border-top: 0.6mm solid #000; padding-top: 1.5mm; margin-top: 1.5mm; } - .store-name { font-size: ${is58 ? '12pt' : '14pt'}; font-weight: bold; text-align: center; margin-bottom: 3px; } + .total-line.grand { font-size: ${is58 ? '13pt' : '15pt'}; font-weight: bold; border-top: 0.6mm solid #000; padding-top: 1.5mm; margin-top: 1.5mm; } + .store-name { font-size: ${is58 ? '14pt' : '16pt'}; font-weight: bold; text-align: center; margin-bottom: 3px; } .store-tagline, .store-info { font-size: ${smallFont}; text-align: center; color: #000; margin-bottom: 5px; line-height: 1.45; } .divider { border: none; border-top: 1px dashed #999; margin: 5px 0; } .divider-double { border: none; border-top: 2px solid #333; margin: 5px 0; } diff --git a/pos/static/pwa/sw.js b/pos/static/pwa/sw.js index bfd89db..c0a6b26 100644 --- a/pos/static/pwa/sw.js +++ b/pos/static/pwa/sw.js @@ -6,7 +6,7 @@ // The fetch handler normalizes static asset URLs (strips ?v= query strings) // so templates can use cache-busting query params freely. -const VERSION = 49; +const VERSION = 50; const CACHE_NAME = 'nexus-pos-v' + VERSION; const APP_SHELL = [