Show barcode as barcode-image on shopping list (closes #1133)

This commit is contained in:
Bernd Bestel
2020-12-20 19:31:12 +01:00
parent b2f555400c
commit 1d16021404
5 changed files with 34 additions and 2 deletions

View File

@@ -8,6 +8,7 @@
{ 'visible': false, 'targets': 5 },
{ 'visible': false, 'targets': 6 },
{ 'visible': false, 'targets': 7 },
{ 'visible': false, 'targets': 8 },
{ "type": "num", "targets": 2 },
{ "type": "html-num-fmt", "targets": 5 },
{ "type": "html-num-fmt", "targets": 6 }
@@ -529,3 +530,18 @@ $(window).on("message", function(e)
window.location.href = U('/shoppinglist?list=' + data.Payload);
}
});
var dummyCanvas = document.createElement("canvas");
$("img.barcode").each(function()
{
var img = $(this);
bwipjs.toCanvas(dummyCanvas, {
bcid: "ean8",
text: img.attr("data-barcode"),
height: 5,
includetext: false
});
img.attr("src", dummyCanvas.toDataURL("image/png"));
});