diff --git a/server/AyaNova/resource/rpt/ay-report.js b/server/AyaNova/resource/rpt/ay-report.js index 31784b2a..3a4ef2cd 100644 --- a/server/AyaNova/resource/rpt/ay-report.js +++ b/server/AyaNova/resource/rpt/ay-report.js @@ -92,15 +92,10 @@ function ayRegisterHelpers() { return ayTranslationKeyCache[translationKey]; }); - /* - let canvas = document.createElement('canvas'); -try { - bwipjs.toCanvas(canvas, options); - document.getElementById(myimg).src = canvas.toDataURL('image/png'); -} catch (e) { - // `e` may be a string or Error object -} - */ + /////////////////////////////////////////// + // BarCode helper using + // https://github.com/metafloor/bwip-js#browser-usage + // Handlebars.registerHelper("ayBC", function (text, options) { let canvas = document.getElementById("aybarcode"); if (canvas == null) { @@ -114,21 +109,7 @@ try { text = text.toString(); } opt.text = text; - 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 - // }; + opt.textxalign = opt.textxalign || "center"; bwipjs.toCanvas(canvas, opt); var url = canvas.toDataURL("image/png");