Search code examples
javascriptbarcodedatamatrix

DataMatrix Barcode in Java Script


How to generate DataMatrix barcode in JavaScript only JavaScript or any other Library in Javascript free

I have an Image and I want to put an generated DataMatrix barcode in this image based on any given Value I tried Jsbarcode Library but It doesn't support DataMatrix barcode


Solution

  • As the author of bwip-js, I am partial to that javascript library. It implements several different datamatrix standards in addition to many other symbologies. Generating a datamatrix symbol is as easy as:

    import { datamatrix } from 'bwip-js';
    
    try {
        datamatrix('my-canvas', options);
    } catch (e) {
        // handle error
    }
    

    That example is for the browser (drawing to a canvas object). The node-js version generates a PNG image in a Buffer.