fix(intake): prevent barcode print stretching

This commit is contained in:
WuYongJie 2026-06-29 13:11:13 +08:00
parent b3d4a6f2ed
commit cec5e2fcb2

View File

@ -312,8 +312,14 @@ function printCommonLayout(
lodop.ADD_PRINT_TEXT(203, 474, 141, 25, record.bar3);
setFont(lodop, 15);
} else {
lodop.ADD_PRINT_TEXT(203, 191, 800, options?.barcodeTextHeight ?? 25, record.barcode);
setFont(lodop, options?.barcodeFontSize ?? 25, true);
// Keep the full barcode on a single row and shrink text when needed.
const barcodeTextHeight = options?.barcodeTextHeight ?? 25;
const barcodeFontSize = options?.barcodeFontSize ?? 25;
lodop.ADD_PRINT_TEXT(203, 191, 800, barcodeTextHeight, record.barcode);
setFont(lodop, barcodeFontSize, true);
lodop.SET_PRINT_STYLEA(0, "TextNeatRow", 1);
lodop.SET_PRINT_STYLEA(0, "WordWrap", 0);
lodop.SET_PRINT_STYLEA(0, "TextFit", 1);
}
lodop.ADD_PRINT_TEXT(182, options?.productionBatchLeft ?? 438, 172, 25, `生产批号:${record.printDate}`);
@ -486,7 +492,7 @@ export async function printBarcodeRow(
}
lodop.NEWPAGE();
lodop.SET_PRINT_MODE("PRINT_PAGE_PERCENT", "Full-Page");
// Print using the configured paper size to avoid stretched output.
template.printFunc(record, lodop, { batchNumber: options.batchNumber });
lodop.PREVIEW();
return template.title;
@ -803,7 +809,7 @@ export async function printCertificateRow(
}
lodop.NEWPAGE();
lodop.SET_PRINT_MODE("PRINT_PAGE_PERCENT", "Full-Page");
// Print using the configured paper size to avoid stretched output.
printCertificateLayout(record, lodop, template, options);
lodop.PREVIEW();
return template.title;