PrintFxv2

This commit is contained in:
jessikitty committed 2026-09-16 11:29:52 +10:00
1 parent 922ce99d25
commit 3b2a399769
7 files changed
+57 -11

No files matched your search

+12 -2
View File
@@ -291,6 +291,9 @@ function explainPrintError(output, host) {
if (/Unknown label|label/i.test(last) && /identifier/i.test(last)) {
return 'The printer rejected the label size. Check the roll loaded matches the badge settings.';
}
if (/Black\/Red|Monochrome media/i.test(output)) {
return 'The printer has a black/red roll loaded but received a monochrome job. Set "Roll loaded in the printer" to the DK-22251 option so the job is built for two-colour tape.';
}
if (/wrong roll|WrongMedia|media/i.test(last)) {
return 'The printer says the roll is wrong. Check "Roll loaded in the printer" matches what is actually in the machine — a black and red job is refused on a plain roll.';
}
@@ -336,15 +339,22 @@ export async function printBadge(visit, site) {
const port = Number(site.printer_port) || 9100;
const target = `tcp://${site.printer_host}:${port}`;
const label = labelFor(site);
const args = [
'--backend', 'network',
'--model', site.printer_model || 'QL-820NWB',
'--printer', target,
'print',
'--label', labelFor(site),
file,
'--label', label,
];
// brother_ql: "You must use this option when printing on black/red tape, even
// when not printing red." Without it the job is built as monochrome, the
// printer sees two-colour media, and refuses the whole thing.
if (label === '62red') args.push('--red');
args.push(file);
try {
await runBrotherQl(args, config.printing.timeoutMs);
note(site.id, true, `Printed to ${site.printer_host}`);
+1 -1
View File
@@ -539,7 +539,7 @@ router.get('/sites/:id/printer-diagnostics', (req, res) => {
'brother_ql --backend network',
`--model ${site.printer_model || 'QL-820NWB'}`,
`--printer tcp://${site.printer_host}:${site.printer_port || 9100}`,
`print --label ${printer.labelFor(site)} badge.png`,
`print --label ${printer.labelFor(site)}${printer.labelFor(site) === '62red' ? ' --red' : ''} badge.png`,
].join(' '),
});
});