JavaScript条形码生成和扫码识别(Barcode scan)开源库

KareemPeter 7年前
   <p>条码具有易操作、易维护的特点。对于室外场合,使用计算机登记信息非常不方便,通过使用条码采集器,可以在操作现场将采集的条码信息保存在采集器中,然后传输到计算机。条码采集器外形轻便,操作简便,不需要安装配置软件系统,极大地提高了系统的使用性。</p>    <p>这里介绍分别甚至JavaScript实现的条形码相关开源库。</p>    <h2>JsBarcode</h2>    <p>JsBarcode 是一个生成条形码的开源库支持的有: CODE128 CODE128 (自动模式切换) CODE128 A/B/C (强制模式)等,在现代流量器上它会生成一个SVG矢量图用来生成条形码,使用如下:</p>    <pre>  <code class="language-javascript">var JsBarcode = require('jsbarcode');  var Canvas = require("canvas");    var canvas = new Canvas();  JsBarcode(canvas, "Hello");    // Do what you want with the canvas  // See https://github.com/Automattic/node-canvas for more information</code></pre>    <p>项目主页:  <a href="/misc/goto?guid=4959740696235750514" rel="nofollow,noindex">https://github.com/lindell/JsBarcode</a></p>    <h2>quaggaJS</h2>    <p>quaggaJS是由H5实现的JavaScript扫码库,能将条形码扫描成文字,支持静态图片和视频流的扫描。使用方法如下:</p>    <pre>  <code class="language-javascript">Quagga.init({      inputStream : {        name : "Live",        type : "LiveStream",        target: document.querySelector('#yourElement')    // Or '#yourElement' (optional)      },      decoder : {        readers : ["code_128_reader"]      }    }, function(err) {        if (err) {            console.log(err);            return        }        console.log("Initialization finished. Ready to start");        Quagga.start();    });</code></pre>    <p>项目主页  <a href="/misc/goto?guid=4959740696325992664" rel="nofollow,noindex">https://github.com/serratus/quaggaJS</a></p>    <p> </p>    <p>来自:http://ourjs.com/detail/58bd0c8c4edfe07ccdb234e9</p>    <p> </p>    <p> </p>