JsBarcode打印demo

2019-11-18 18:38:44  卢浮宫  阅读量:140  版权声明:本文为站长原创文章,转载请写明出处


一、补充,记录一个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>

三、效果如下

    

最新评论: