Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated Barcode is not readable #10

Closed
nilesh211 opened this issue Mar 27, 2015 · 7 comments
Closed

Generated Barcode is not readable #10

nilesh211 opened this issue Mar 27, 2015 · 7 comments
Labels

Comments

@nilesh211
Copy link

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.

@samt
Copy link
Owner

samt commented Mar 28, 2015

Can you attach an output image to this ticket and post a relevant code snippet?

@nilesh211
Copy link
Author

var PDFDocument = require('pdfkit');
var BarCode = require('barcode');
var doc = new PDFDocument({margin: 20});
doc.pipe(res);
doc.pipe(fileSystem.createWriteStream(fPdfName));

var barCodeText = '001,221,Nilesh';
var code39 = BarCode('code39', {
    data: barCodeText,
    width: 400,
    height: 100
});

code39.getBase64(function (err, imgsrc) {
    if (err) throw err;

    doc.moveDown(0.7)
    .image(imgsrc, {
        width: 220,
        height: 25,
        x: 363,
        y: 60
    })
});

image

@nilesh211
Copy link
Author

I had one more query.. Suppose i need to deploy my code to hereku server then how to install graphicsmagicx in it??? i have install graphicsmagick in my system and the barcode is generated.. ..what if i deploy it in hereku server??

@samt
Copy link
Owner

samt commented Mar 28, 2015

If Heroku does not have Graphics Magic installed, it cannot run, I am afraid.

@nilesh211
Copy link
Author

Thanks Sam... Can you please let me know why the barcode generated is not readable through barcode scanner?

@samt
Copy link
Owner

samt commented Mar 28, 2015

If you increase the pixel width of your output image, you should be able to read it with a scanner. What's going on here is that that the image is being squished which makes it hard for the scanner to distinguish between narrow bars and wide bars.

Additionally, code39 takes a lot of space to represent the data you give it, so it's really only good for short numbers or short phrases. If your barcode gets too long with code39, you might want to try a higher density barcode or shorten your message you're sending through.

@samt samt added the question label Aug 24, 2015
@samt
Copy link
Owner

samt commented Aug 24, 2015

Making this easier to surface to the user, see #14

@samt samt closed this as completed Aug 24, 2015
@samt samt mentioned this issue Aug 24, 2015
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants