huysentruitw / barcoder

Lightweight Barcode Encoding Library for .NET Framework, .NET Standard and .NET Core.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] [DataMatrix] Support GS1

Int32Overflow opened this issue · comments

Support for FNC1

@huysentruitw Do you know how to get GS1 functionality into the DataMatrix?

@huysentruitw Sorry to bother you. When would you have time for the implementation?

Hi @Int32Overflow thank you for your patience! I would like to know how you would see the usage? How will we pass the AI's with their data? I was thinking to allow strings like (01)03453120000011(17)190704 and pass a true to gs1ModeEnabled in public static IBarcode Encode(string content, int? fixedNumberOfRows = null, bool gs1ModeEnabled = false). Would that be ok, or do you have something else in mind?

It is sufficient if a certain string sequence is existing in the string for GS1. For example (01)03453120000011\{FNC1}(17)190704

If I understand correctly, FNC1 control char is only added to end non-predefined length AI's. My idea would be to do that implicitly, so you don't have to add FNC1 yourself in the string.

Yes, that's correct. Then you'll have to parse the entire string.

For me the solution with the string "{FNC1}" would be more useful... Especially because the solution to parsing the string will be a great deal of effort!

Just a reminder, I'm not forgetting this, time is just very limited ATM.

@Int32Overflow thank you very much for your patience. GS1 support has been added to the DataMatrix encoder.

Usage:

var dataMatrix = DataMatrixEncoder.Encode("(01) 0 0614141 99999 6 (90) 1234567890", gs1ModeEnabled: true)

This will be available as of version 1.0.0.61

Enjoy! 🎉

Had to fix a bug, so please test with version 1.0.0.63

@huysentruitw Thank you very much for the implementation.

But I think I found a bug in the GS1 implementation: Application Identifiers with variable measure trade item may not work. For example AI "3100" (https://www.gs1.org/standards/barcodes/application-identifiers/3100?lang=en)

Another question: We could also use this GS1 parser for the Code128, couldn't we?

Unknown AI's will be terminated by a FNC1 char, so it probably will work although the FNC1 could have been omitted.

For your Code128 question, I think so yes. I'll look into that.

Unknown AI's will be terminated by a FNC1 char, so it probably will work although the FNC1 could have been omitted.

But this is not a valid GS1 DataMatrix code. AI 3100 has a fixed size and don't required any FNC1 seperator

Indeed, they don't require it, but it is allowed to use the FNC1 separator either way if I'm correct. It's just not that optimal.

Indeed, they don't require it, but it is allowed to use the FNC1 separator either way if I'm correct. It's just not that optimal.

Should I rewrite the parser to support the GS1 AI 3100? Maybe I have a solution for that.

Already fixed in 2c94394