2f1675af1d
Deploy to LXC / deploy (push) Successful in 19s
The custom @page margins conflicted with browser minimum margins, causing overflow. Now @page margin is 0, barcode height 8mm→6mm, scale 3→2, text size 12→10 so content fits within 29mm even with browser minimum margins selected. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
18 lines
448 B
TypeScript
18 lines
448 B
TypeScript
// @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: 2,
|
|
height: 8,
|
|
includetext: true,
|
|
textsize: 10,
|
|
textxalign: 'center'
|
|
});
|
|
|
|
// Return as base64 data URL for embedding in HTML
|
|
return `data:image/png;base64,${buf.toString('base64')}`;
|
|
}
|