Configureable barcode format via bwp-js

This commit is contained in:
2023-02-01 17:39:03 +01:00
parent e5a01bcd76
commit 9e06c46411
4 changed files with 3197 additions and 55 deletions

View File

@@ -331,11 +331,22 @@
import { reactive } from "vue";
import { TYPE, useToast } from "vue-toastification";
import axios from "redaxios";
import JsBarcode from "jsbarcode";
import bwipjs from "bwip-js";
function textToBase64Barcode(text){
var canvas = document.createElement("canvas");
JsBarcode(canvas, text, {format: "CODE128", displayValue:false});
bwipjs.toCanvas(canvas,
{
bcid: config.codeformat,
text: text,
scale: 4,
height: 10,
// width: 10,
includetext: true,
textxalign: 'center',
backgroundcolor: 'ffffff'
}
)
return canvas.toDataURL("image/png");
}
@@ -353,6 +364,7 @@ const state = reactive({
delete_active: false,
fullobject: {}
})
state.barcode = textToBase64Barcode("12345");
const toast = useToast();
const props = defineProps({
token: String