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

How to specify 128 A? #31

Open
rdyar opened this issue Dec 2, 2020 · 6 comments
Open

How to specify 128 A? #31

rdyar opened this issue Dec 2, 2020 · 6 comments
Assignees

Comments

@rdyar
Copy link

rdyar commented Dec 2, 2020

On your encoder here: https://graphicore.github.io/librebarcode/ is it possible to specify to encode the string as 128A?

I see in the encode.js file what looks like different start characters for 128A, B and C but I don't see how to specify which one.

I have a spec that says my barcode should be 128A and I am thinking just encoding like you are and wrapping it in the libracode font is not actually doing that?

I have an example barcode and other than the first few lines mine matches but I think those first few lines are the start character but not specifically 128A.

@graphicore
Copy link
Owner

On your encoder here: https://graphicore.github.io/librebarcode/ is it possible to specify to encode the string as 128A?

No.

The encoder is optimizing for length and switching codes when appropriate. Code B adds mainly "lowercase" characters and Code C offers possible size reductions by encoding numbers from 00 to 99 in one symbol instead of two.

If you restrict your input to symbols that are only in Code A you basically have to calculate the checksum character and are done:

{Start Code A =Ë}{YOUR INPUT}{checksum char}{stopChar = Î}

No optimizing and code switching needed.

I have an example barcode and other than the first few lines mine matches but I think those first few lines are the start character but not specifically 128A.

If you look into encoder.js, the first entries in Code A and Code B encode the same values, so if the encoder starts with Code B and you only have encoded chars common to Code A and B, only the start symbol and the checksum/digit should differ, (checkdigit could be the same in some cases).

If you need further help with this please ask.

@rdyar
Copy link
Author

rdyar commented Dec 2, 2020

thanks for the quick reply. I think I am getting there. This is for an amazon specific barcode, they say to use code 128A - which to me means the start character is Ë but when they generate the barcode the start character is Ì which is a little confusing. So the code from your encoder app and from amazon both match - but to me they both have the wrong start character if you are told it has to be 128A.

I'm guessing it is no big deal - I edited the encode.js file to have all 3 have the same start digit as A but then undid that when I saw that the labels amazon creates match what you have. A service that makes this same barcode looks like it has Ë for its start code which to me is correct. That bar code and the one amazon generates both work, even though the start code is different.

To me it looks like what amazon wants you to do 128 Auto which is what it sounds like your encoder is doing.

@graphicore
Copy link
Owner

graphicore commented Dec 10, 2020

I'll leave this open as a feature request for the encoder.

So the code from your encoder app and from amazon both match - but to me they both have the wrong start character if you are told it has to be 128A.

I'm guessing it is no big deal - I edited the encode.js file to have all 3 have the same start digit as A but then undid that when I saw that the labels amazon creates match what you have. A service that makes this same barcode looks like it has Ë for its start code which to me is correct. That bar code and the one amazon generates both work, even though the start code is different.

I agree, however, if they accept it it's not too bad.

To me it looks like what amazon wants you to do 128 Auto which is what it sounds like your encoder is doing.

Maybe they just want to make sure that you encode only uppercase characters.

@graphicore graphicore self-assigned this Dec 10, 2020
@rdyar
Copy link
Author

rdyar commented Dec 10, 2020

I ended up switching to JsBarcode as it allows you to specify 128A. I liked the way the libre font worked though, and would prefer it if there was a way to specify the code type.

That said my use case may be a bit weird - a spec to follow where even the spec creator is not following the spec. Good times.

Thanks for your work and help.

@graphicore
Copy link
Owner

Thanks for the feedback!

@pfumagalli
Copy link

In case someone stumbles here for the same reason (third party logistics provider can be awfully annoying in what they require), I needed to have the same feature, so I made it available here:

https://www.npmjs.com/package/@juit/librebarcode#encoding-with-a-specific-code-set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants