Giter Site home page Giter Site logo

barcode's People

Contributors

samt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

barcode's Issues

error

require('barcode')('ean13', { data: '123456', width: 100, height: 50 }).getStream(function(err, s){
    console.log(s);
});

it will get a spawn error, why?

Not writing any data

Hi,

I am trying the example exactly as it is documented but none of my files receive any data (they are written with 0 bytes). For example:

var barcode = require('barcode');
var outfile = 'done.png';

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

code39.saveImage(outfile, function (err) {
  if (err) throw err;
  console.log('File has been written!');
});

Says "File has been written" but there is no data there. The same is true with the other examples (piping for example).

Convert all image generation to Barcode1D

Would clean things up a bit. Basically, every pattern creation must output a flat array of bar widths to pass on to the Barcode1D class, then it's basically a drop-in replacement.

Expose CLI interface

Support for installing this module globally and running it via the command line will be super helpful.

Better error handing

  • Make 'Degenerate barcode' error more descriptive. See #10 , #12
  • Catch fs read/write exceptions and surface them in a way relevant to the library. See #8

Update the example to reflect most recent npm module

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.

How to get Base64..?

i have barcode object..
Barcode {
barcode: { createCode: [Function] },
options:
{ data: '282',
width: 400,
height: 100,
barcolor: '#000',
bgcolor: '#FFF',
w: 400,
h: 100,
type: 'PNG' } }

Seems to have Conflict when create image file with model 'node-opcua'

Hi @samt , when I try to generate barcode image file in my application, I found the barcode in the image file can't be recognized. Then I just write a demo:

var barcode = require('barcode');
var opcua = require('node-ua');
var path = require('path');
var code39 = barcode('code39', {
    data: "r1001-20160906-0001",
    width: 500,
    height: 100,
});
var outfile = path.join(__dirname, '../temps/imgs', 'mycode2.png');
code39.saveImage(outfile, function (err) {

    if (err) throw err;
    console.log('File has been written!');

});

The image is
mycode2
It cannot scan correctly.
When I removed
var opcua = require('node-ua');
Then the image is
mycode
It's OK.

I found there is a model 'colors' in its node_modules . I guess model 'colors' caused the conflict .
How to avoid it?

Externalize Pattern Generation

Take all pattern generation code and place it into a function to generate it.

Should have this prototype:

/*
 * @param String|Array sequence - Sequence of compatible characters for encoding
 * @param String|Int checkdigit - calculated check digit
 * @return Array<Int> - Array of bar/space widths (alternating, starting with bar)
 */
function generateSequence(sequence, checkdigit) { } 

Error: ENOENT

Hi Guys,
I am using this barcode module, I did all the steps that is given in description but I am getting Below error. I have also installed imagemagick as I see on stackoverflow.

events.js:72
throw er; // Unhandled 'error' event
^
Error: ENOENT, open '/home/user/application/controllers/imgs/mycode.png'

I am waiting for your response.
Thanks

Human readable barcode

I have generated the barcode .But it doesn't have barcode written below the image.Can we do something to make the barcode appear below the image

Unhandled error and empty image

var barcode = require('barcode');
var path = require('path');
var code128 = barcode('code128', {
    data: "r1001-20160906-0001",
    width: 500,
    height: 100,
});
var outfile = path.join(__dirname, 'imgs', 'mm.png');
code128.saveImage(outfile, function (err) {

    if (err) throw err;
    console.log('File has been written!');

});

this is what I get.

throw er; // Unhandled 'error' event
      ^
Error: spawn gm ENOENT
    at exports._errnoException (util.js:1050:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:607:11)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)
    at bootstrap_node.js:542:3

It generates an empty image .

Speed up generate barcode

Can we generate barcode a little bit faster. Each barcode take about one second, how can we generate more barcode with less time.

Max-width option instead of fixed width option

While creating barcode, we need to give fixed width. So, sometimes, generated barcode ends up taking more space than required. It would be great to return barcode image of exact size of barcode. So, one way could be to give max-width option. And try generating barcode image of actual size(not of max-width).

let code128 = Barcode('code128', { data: invoiceData.packageCode, maxWidth: 230, height: 50 });

npm found 2 vulnerabilities (1 low, 1 critical)

Plz fix it

E:\project>npm audit
                                                                                
                       === npm audit security report ===


                                 Manual Review
             Some vulnerabilities require your attention to resolve

          Visit https://go.npm.me/audit-guide for additional guidance


  Critical        Command Injection in gm

  Package         gm

  Patched in      >=1.21.1

  Dependency of   barcode

  Path            barcode > gm

  More info       https://github.com/advisories/GHSA-pjh3-jv7w-9jpr


  Low             Regular Expression Denial of Service in debug

  Package         debug

  Patched in      >=2.6.9

  Dependency of   barcode

  Path            barcode > gm > debug

  More info       https://github.com/advisories/GHSA-gxpj-cx7g-858c

found 2 vulnerabilities (1 low, 1 critical) in 160 scanned packages
  2 vulnerabilities require manual review. See the full report for details.

Converting circular structure to JSON

have you seen this error while trying to create a Code39 barcode?

error: uncaughtException: Converting circular structure to JSON

Here is my code, I just wanted to see if i could get it writing to the filesystem first:

    server.get(version+'/tickets/:id/barcode', function(req, res) {
        var code39 = barcode('code39', {
            data: "it works",
            width: 400,
            height: 100,
            type: 'PNG'
        });

        var outfile = path.join(__dirname, 'imgs', 'mycode.png')
        code39.saveImage(outfile, function (err) {
            console.log('File has been written!');
        });

    });

require issue

Hello !

I just installed GM + barcode this way :

brew install graphicsmagick
npm install --save barcode

I'm trying to use it this way :

var barcode = require('barcode');

barcode('ean13', {
    data: myEan13,
    width: 400,
    height: 100,
});

but I get this error in the browser console :

Uncaught Error: Cannot find module './lib/ean13'

I verified in the node_modules/barcode folder, the file ./lib/ean13s exists ...

Any idea ?
Thanks !!

Generated Barcode is not readable

Hi,
I followed the steps provided. I am able to generate the barcode. But the generated barcode value is not readable in barcode scanner. Can you please advise if i might have missed some steps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.