samt / barcode

barcode generation for nodejs
MIT License
69 stars 59 forks source link

Update the example to reflect most recent npm module #3

Closed ogeagla closed 10 years ago

ogeagla commented 10 years ago

If I follow this example to save to file:

var barcode = require('barcode');
var code39 = barcode('code39', {
    data: "it works",
    width: 400,
    height: 100,
});

var outfile = path.join(__dirname, 'imgs', 'mycode.png')
code39.saveImage(outfile, function (err) {
    if (err) throw err;

    console.log('File has been written!');
});

Then code39.js:67 throws a TypeError because type is undefined:

    type: _options.type.toUpperCase().trim() || 'PNG'

Documentation/example should reflect that this field is mandatory.

ogeagla commented 10 years ago

Additionally, width and height must be changed to w and h.

samt commented 10 years ago

Yep... I'll update that shortly.

285858315 commented 10 years ago

Me too..