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

Code 128 manual subset selection #58

Open
Siyfion opened this issue Apr 15, 2016 · 13 comments
Open

Code 128 manual subset selection #58

Siyfion opened this issue Apr 15, 2016 · 13 comments

Comments

@Siyfion
Copy link

Siyfion commented Apr 15, 2016

I was wondering whether it is possible to create a Code 128 barcode, but with different subsets used for different parts of it? More specifically, say subset A for the first 8 characters, B for the next 10, etc.

I’ve never come across anything like this before and wondered whether BWIPP would be able to generate such a barcode?

@terryburton
Copy link
Member

On 15 April 2016 at 12:38, Simon Mansfield [email protected] wrote:

I was wondering whether it is possible to create a Code 128 barcode, but with different subsets used for different parts of it? More specifically, say subset A for the first 8 characters, B for the next 10, etc.

I’ve never come across anything like this before and wondered whether BWIPP would be able to generate such a barcode?

The specifications discourage such usage.

It sounds like what you might find useful would be the ability to
directly specify the codewords, avoiding the high-level encoding
entirely?

Might I ask what the use case is?

@oehhar
Copy link

oehhar commented Apr 15, 2016

Am 15.04.2016 um 14:40 schrieb Terry Burton:

On 15 April 2016 at 12:38, Simon Mansfield [email protected] wrote:

I was wondering whether it is possible to create a Code 128 barcode,
but with different subsets used for different parts of it? More
specifically, say subset A for the first 8 characters, B for the next
10, etc.

Simon,

Normally, the character changes are chosen automatically to get minimal
code length. You want that, as shorter codes increase readability.

Example data: 1234567A
Low Level Codewords (automatically chosen): [Start C] [12] [34] [56]
[Change B] [7] [A] [Check] [Stop]
-> 9 Codewords

Perhaps you don't know, that bwipp cares about this automatically and
there is no need to specify anything.

A reason to specify the "charset" is to get contant code length with
constant data length. If you specify "Set B" for the upper code, you get
a constant length, even if you encode digits or alphas:
[Start B] [1] [2] [3]... -> 11 Codewords

Those two use-cases are covered. Is your use case one of those ?

Hope this helps,
Harald

@Siyfion
Copy link
Author

Siyfion commented Apr 15, 2016

I need to generate a barcode to the Interlink specification, which states that certain parts of the barcode must be encoded with specific subsets.

Here's a copy of the spec:
Interlink UK.pdf

EDIT: I know that their spec is stupid from a readability point-of-view, but I need to adhere to it 😢

@oehhar
Copy link

oehhar commented Apr 15, 2016

Am 15.04.2016 um 14:55 schrieb Simon Mansfield:

I need to generate a barcode to the Interlink specification, which
states that certain parts of the barcode must be encoded with specific
subsets.

Here's a copy of the spec:
Interlink UK.pdf
https://github.com/bwipp/postscriptbarcode/files/221002/Interlink.UK.pdf

Ok, thank you.

Harald

@terryburton
Copy link
Member

terryburton commented Apr 15, 2016

@Siyfion I've just remembered that I included a "raw" option (or "encoding=raw") that allows you to specify the codewords directly.

See: https://github.com/bwipp/postscriptbarcode/wiki/Code-128
Alongside the encoding table here: https://en.wikipedia.org/wiki/Code_128#Bar_code_widths

To take Harald's (@oehhar) example above:

Example data: 1234567A
Low Level Codewords: [Start C] [12] [34] [56] [Change B] [7] [A]
These final codewords are automatic: [Check] [Stop]

0 0 moveto (^105^012^034^056^100^023^033) (raw) /code128 /uk.co.terryburton.bwipp findresource exec

@Siyfion
Copy link
Author

Siyfion commented Apr 15, 2016

@terryburton I saw the raw option, but to be completely honest, I had no-idea how to use it! Any way I could get you to do a small example of it's usage? Hell, I'm sure it'd be useful in the Wiki too

@terryburton
Copy link
Member

Updated comment above.

@Siyfion
Copy link
Author

Siyfion commented Apr 15, 2016

Awesome, thanks! I'll give that a go now. 👍

@Siyfion Siyfion closed this as completed Apr 15, 2016
@terryburton
Copy link
Member

Leaving this fragment from offline here:

Terry Burton (@terryburton) wrote:

Grrr. The GeoPost specification should not be dictating what the
internal representation of the barcode should be since a
standards-compliant barcode reader would not reveal such data anyway!

That said, a very brief reading of the spec seems to indicate that
the data format complies with a run of alphanumeric data following by
numeric data. If that is so then BWIPP's optimising encoder will
naturally produce Mode B data for the leading characters (including
the short run of digits in a post code) then switch to Mode C for the
numeric tail.

Royal Mail has similar requirements over Data Matrix for their new
postal symbology. After talking to their developers it turns out that
all they intended to achieve was stability in the output size, which
is probably the case here.

@metafloor
Copy link
Contributor

Terry, just to add a note to this closed issue.

We had a situation at a factory where we had to program a fixed scanner to ignore code128 symbols that started in subset-C. The labels it was scanning contained three code128 symbols, with the top one always starting in subset-C. We wanted only the other two bar codes.

Why I bring this up? Sometimes, because of automatic encoding, one of the other two bar codes would also start in subset-C....

We unfortunately had no control over those labels, but I think it demonstrates a use-case for at least forcing the starting subset.

Cheers, Mark

@terryburton
Copy link
Member

On 15 Apr 2016 19:38, "metafloor" [email protected] wrote:

Terry, just to add a note to this closed issue.

We had a situation at a factory where we had to program a fixed scanner
to ignore code128 symbols that started in subset-C. The labels it was
scanning contained three code128 symbols, with the top one always starting
in subset-C. We wanted only the other two bar codes.

Why I bring this up? Sometimes, because of automatic encoding, one of the
other two bar codes would also start in subset-C....

We unfortunately had no control over those labels, but I think it
demonstrates a use-case for at least forcing the starting subset.

That's useful, thanks!

@terryburton terryburton added this to the A bounty would help milestone Jul 6, 2016
@terryburton terryburton reopened this Jul 6, 2016
@terryburton terryburton changed the title Code 128 with manual subset usage? Code 128 manual subset selection Jul 6, 2016
@aprking
Copy link

aprking commented May 21, 2024

When using the bwip-js.js library to generate a Code 128 barcode, if the symtext content is "^105^012^034^056^100^023^033" and symopts are set to include text with "includetext raw" option, the text content will not be displayed. How can this be resolved?
code128

@terryburton
Copy link
Member

When using the bwip-js.js library to generate a Code 128 barcode, if the symtext content is "^105^012^034^056^100^023^033" and symopts are set to include text with "includetext raw" option, the text content will not be displayed. How can this be resolved?

The BWIPP library is an encoder not a decoder, so it does not attempt to convert from codewords back to text. You can however supply the alttext option alongside the raw option. Refer to the documentation.

Please can you describe the use case (application specification, etc.) that requires you to drive the encoding using the raw option, and what is the codeword format that is required?

Only the other day I encountered a proprietary application that required the gratuitous use of switch-A/B/C codewords in Code-128 that no longer works with modern scanning equipment. (These implement GS1 Composite, for which there is a standard use of the same codewords for "linkage" purposes.)

So I am more inclined to create helper symbologies for applications that require discouraged encoding tweaks than to shoehorn features into the generic encoders without reference to why they are required. It's difficult to anticipate the extent of implementer's stupidity!

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

5 participants