diff --git a/public/env.sample.js b/public/env.sample.js index e561d12..142bf66 100644 --- a/public/env.sample.js +++ b/public/env.sample.js @@ -13,5 +13,4 @@ const config = { url_imprint: '', // optional, will fallback to baseurl_selfservice/privacy url_privacy: '', - codeformat: 'code39' }; diff --git a/src/views/Profile.vue b/src/views/Profile.vue index abb7a02..0cc7e4a 100644 --- a/src/views/Profile.vue +++ b/src/views/Profile.vue @@ -638,17 +638,19 @@ import axios from "redaxios"; import bwipjs from "bwip-js"; function textToBase64Barcode(text) { - var canvas = document.createElement("canvas"); - bwipjs.toCanvas(canvas, { - bcid: config.codeformat || "code39", + const canvas = document.createElement("canvas"); + let codeconfig = { + bcid: config.code_format || "code39", text: `${text}`, scale: 3, - height: 10, - // width: 10, includetext: false, textxalign: "center", backgroundcolor: "ffffff", - }); + }; + if (codeconfig.bcid === "code39" || codeconfig.bcid === "code128"|| codeconfig.bcid === "ean13") { + codeconfig.height = 10; + } + bwipjs.toCanvas(canvas, codeconfig); return canvas.toDataURL("image/png"); } @@ -749,13 +751,13 @@ function get_certificate() { } else { var fileURL = window.URL.createObjectURL( new Blob([response.data], { type: "application/pdf" }) - ); + ); var fileLink = document.createElement("a"); fileLink.href = fileURL; fileLink.setAttribute("download", "Certificate.pdf"); document.body.appendChild(fileLink); - + fileLink.click(); fileLink.remove(); toast.clear();