Files
label_printing/node_modules/jsbarcode/example/toBase64.html
2022-02-21 15:01:43 +01:00

22 lines
510 B
HTML

<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<script src="../dist/JsBarcode.all.js"></script>
<script>
function textToBase64Barcode(text){
var canvas = document.createElement("canvas");
JsBarcode(canvas, text, {format: "CODE39"});
return canvas.toDataURL("image/png");
}
</script>
</head>
<body>
<a id="hello">Click Here</a>
<script>
document.querySelector("#hello").href = textToBase64Barcode("HELLO");
</script>
</body>
</html>