How to use the bwip-js.loadFont function in bwip-js

To help you get started, we’ve selected a few bwip-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / bwip-js / bwip-js-tests.ts View on Github external
import * as bwipjs from 'bwip-js';
import * as http from 'http';
import * as fs from 'fs';

bwipjs.loadFont('Inconsolata', 108,
    fs.readFileSync('fonts/Inconsolata.otf', 'binary'));


http.createServer(function(req, res) {
    // If the url does not begin /?bcid= then 404.  Otherwise, we end up
    // returning 400 on requests like favicon.ico.
    if (req.url!.indexOf('/?bcid=') != 0) {
        res.writeHead(404, { 'Content-Type':'text/plain' });
        res.end('BWIPJS: Unknown request format.', 'utf8');
    } else {
        bwipjs(req, res);
    }

}).listen(3030);

bwipjs.toBuffer({

bwip-js

JavaScript barcode generator supporting over 100 types and standards.

MIT
Latest version published 3 months ago

Package Health Score

80 / 100
Full package analysis

Popular bwip-js functions