This commit is contained in:
@@ -92,15 +92,10 @@ function ayRegisterHelpers() {
|
|||||||
return ayTranslationKeyCache[translationKey];
|
return ayTranslationKeyCache[translationKey];
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
///////////////////////////////////////////
|
||||||
let canvas = document.createElement('canvas');
|
// BarCode helper using
|
||||||
try {
|
// https://github.com/metafloor/bwip-js#browser-usage
|
||||||
bwipjs.toCanvas(canvas, options);
|
//
|
||||||
document.getElementById(myimg).src = canvas.toDataURL('image/png');
|
|
||||||
} catch (e) {
|
|
||||||
// `e` may be a string or Error object
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
Handlebars.registerHelper("ayBC", function (text, options) {
|
Handlebars.registerHelper("ayBC", function (text, options) {
|
||||||
let canvas = document.getElementById("aybarcode");
|
let canvas = document.getElementById("aybarcode");
|
||||||
if (canvas == null) {
|
if (canvas == null) {
|
||||||
@@ -114,21 +109,7 @@ try {
|
|||||||
text = text.toString();
|
text = text.toString();
|
||||||
}
|
}
|
||||||
opt.text = text;
|
opt.text = text;
|
||||||
opt.textxalign = "center";
|
opt.textxalign = opt.textxalign || "center";
|
||||||
|
|
||||||
if (opt.pad && opt.text) {
|
|
||||||
//pad out the code by inserting leading zeros to the specified length
|
|
||||||
opt.text = ayPad(opt.text, opt.pad, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// let opt = {
|
|
||||||
// bcid: "code128", // Barcode type
|
|
||||||
// text: "0123456789", // Text to encode
|
|
||||||
// scale: 3, // 3x scaling factor
|
|
||||||
// height: 10, // Bar height, in millimeters
|
|
||||||
// includetext: true, // Show human-readable text
|
|
||||||
// textxalign: "center" // Always good to set this
|
|
||||||
// };
|
|
||||||
|
|
||||||
bwipjs.toCanvas(canvas, opt);
|
bwipjs.toCanvas(canvas, opt);
|
||||||
var url = canvas.toDataURL("image/png");
|
var url = canvas.toDataURL("image/png");
|
||||||
|
|||||||
Reference in New Issue
Block a user