Add DK-22210 label printing with barcode and QR code

- Print page formatted for Brother DK-22210 (29mm continuous tape)
- Each label has: title, brand/model, serial, QR code, Code 128 barcode
- CSS @page sized to 29mm width with minimal margins
- Print button opens popup that auto-triggers print dialog
- Copies selector to print multiple labels at once
- Barcode encodes short ID (first 8 chars) scannable by the lookup endpoint
- Available on both device and component detail pages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 11:26:53 +07:00
parent 8859f32b4f
commit 45d93738d7
9 changed files with 314 additions and 2 deletions
+17
View File
@@ -0,0 +1,17 @@
// @ts-expect-error bwip-js types not resolved by bundler moduleResolution
import bwipjs from 'bwip-js';
export async function generateBarcodeSvg(text: string): Promise<string> {
const buf = await bwipjs.toBuffer({
bcid: 'code128',
text,
scale: 3,
height: 8,
includetext: true,
textsize: 8,
textxalign: 'center'
});
// Return as base64 data URL for embedding in HTML
return `data:image/png;base64,${buf.toString('base64')}`;
}