samt / barcode Goto Github PK
View Code? Open in Web Editor NEWbarcode generation for nodejs
License: MIT License
barcode generation for nodejs
License: MIT License
Move to lib/utils
hi, i have a problem using 128.
when i try to convert an odd number like 2125000005993, the library will adds a 'zero' to the first of my number.
what should i do?
thanks
Support for installing this module globally and running it via the command line will be super helpful.
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 .
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).
Can we generate barcode a little bit faster. Each barcode take about one second, how can we generate more barcode with less time.
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!');
});
});
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 });
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.
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.
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' } }
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
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
It cannot scan correctly.
When I removed
var opcua = require('node-ua');
Then the image is
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?
require('barcode')('ean13', { data: '123456', width: 100, height: 50 }).getStream(function(err, s){
console.log(s);
});
it will get a spawn error, why?
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.
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
I can't use gm in my environment, but I install imageMagick instead.
in the document says we could use the code to change the gm implement.
http://aheckmann.github.io/gm/docs.html#imagemagick
var imageMagick = gm.subClass({ imageMagick: true });
I have to change the code in lib folder manually, could we have a config to setup this ?
is it possible in the saveImage method to append extra unencoded text ie
{{barcode}}
product name
size
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.
I have generated a barcode of dimensions width: 200, height: 50. But i am getting an error
"Error: Width will result in a degenerate barcode".
Can we generate a barcode of this dimension?
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 !!
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) { }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.