2019-11-18 10:38:44 卢浮宫 版权声明:本文为站长原创文章,转载请写明出处
补充、记录一个JsBarCode进行打印的demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>js生成条形码插件</title>
<script src="https://cdn.bootcss.com/jsbarcode/3.8.0/JsBarcode.all.min.js"></script>
<style>
* {margin: 0;padding: 0;box-sizing: border-box;}
h3 {text-align: center;font-size: 16px;margin: 10px;}
.box {text-align: center;}
#barcode {width: 200px;}
</style>
</head>
<body>
<h3>js自动生成条形码插件-JsBarcode</h3>
<div class="box">
<img id="barcode" />
</div>
</body>
<script>
var barcode = document.getElementById('barcode'),
str = "LFG121345678963554",
options = {
format: "CODE128",
displayValue: true,
fontSize: 18,
height: 100
};
JsBarcode(barcode, str, options);
</script>
</html>