fix codeconfig.height
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
713dd15312
commit
9b261bf200
|
@ -597,18 +597,18 @@ import axios from "redaxios";
|
||||||
import bwipjs from "bwip-js";
|
import bwipjs from "bwip-js";
|
||||||
|
|
||||||
function textToBase64Barcode(text) {
|
function textToBase64Barcode(text) {
|
||||||
var canvas = document.createElement("canvas");
|
const canvas = document.createElement("canvas");
|
||||||
// bwipjs.toCanvas(canvas, text, {format: config.code_format || "code128", displayValue:false});
|
let codeconfig = {
|
||||||
bwipjs.toCanvas(canvas, {
|
|
||||||
bcid: config.code_format || "code128",
|
bcid: config.code_format || "code128",
|
||||||
text: `${text}` || "?",
|
text: `${text}` || "?",
|
||||||
scale: 3, // 3x scaling factor
|
scale: 3,
|
||||||
height: 10, // Bar height, in millimeters
|
includetext: false,
|
||||||
includetext: false, // Show human-readable text
|
};
|
||||||
textxalign: "center", // Always good to set this
|
if (codeconfig.bcid === "code128" || codeconfig.bcid === "ean13") {
|
||||||
});
|
codeconfig.height = 10; // bar height in mm
|
||||||
|
}
|
||||||
|
bwipjs.toCanvas(canvas, codeconfig);
|
||||||
const base64 = canvas.toDataURL("image/png");
|
const base64 = canvas.toDataURL("image/png");
|
||||||
console.log(base64);
|
|
||||||
return base64;
|
return base64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue