0

I've tried this kind of code to have something "correct" to generate the label I need:

GS1Barcode barcode = new GS1Barcode();
barcode.ProductCode = ProductCode.ParseGtin(normalizedPresentationCode);
string barcodeString = new BarcodeParserBuilder.BarcodeParserBuilder().Build(barcode);

It's from BarcodeParserBuilder.

I wanted to have a label to send to a Zebra Printer. It's working great with 14 char product code, but it's not with a 8 char product code like "40170725" which is not accepted, so I tried by adding "0" before to be compliant (I checked here). The barcodeString is equal to "0100000040170725" at the end (I also tried with "(01)00000040170725").

To generate the zpl, I've used this:

$"^XA\r\n^FO10,15\r\n^FB390,3,0,C,0\r\n^A0,22,22\r\n^FD{parsedArticleName}\r\n^FS\r\n^FO10,70\r\n^BXN,5,200\r\n^FD{barcodeString}\r\n"
                    + $"^FS\r\n^FO200,75\r\n^A0,24,24\r\n^FD{pFullPack.PresentationCode}\r\n^FS\r\n^FO250,100\r\n^A0,36,34\r\n^FDx {pFullPack.PackRemainingQuantity}\r\n^FS\r\n^FO200,140\r\n^A0,22,22\r\n"
                    + $"^FD{_resourceManager.GetString("Batch")} {pFullPack.BatchNum}\r\n^FS\r\n^FO200,170\r\n^A0,22,22\r\n"
                    + $"^FD{_resourceManager.GetString("Expiration")} {pFullPack.PackDateExpiry:MM/yyyy}\r\n^FS\r\n^FO10,190\r\n^A0,16,16\r\n^FD{_resourceManager.GetString("On")} {DateTime.Now:dd/MM/yyyy}\r\n^FS\r\n^XZ";

The generated label (I used this) with this and my 8 char: here

But the final label is not recognized by Zxling (I tried here).

Do anyone have a clue on why my label with my qrcode (datamatrix I think) is not recognized ?

I tried giving this argument to GS1Barcode (from here, but unsuccessfully:

new GS1Barcode(BarcodeParserBuilder.Aim.AimSymbologyIdentifier.ParseString("]E4"))

Edit : I also tried to "start" with:

EanBarcode barcode = new EanBarcode();

for that, expiry date and batch are not recognized (so I skipped them in the barcode part) at all, the result is here but it's not recognized by zebra scanner website. But at least, I don't have an exception anymore

4
  • What is the value of barcodeString? A GTIN is always a 14-digit value, by definition. When encoded as a GS1-compliant barcode, it will be prefixed with the 01 data identifier. There is no concept of zero-padding with GTIN, so barcode scanners will not strip leading zeros. If you want the barcode to contain just 40170725, then don't encode it as a GTIN. Commented Jan 7 at 20:37
  • @MarkWarren the productcode is 40170725 (or whatever 8 digit), the "barcode.ProductCode" is asking me for a "BarcodeParserBuilder.Infrastructure.ProductCodes.GtinProductCode", giving it that string will result as an exception, and a strange one: if (!value.All(char.IsDigit)) { throw new ArgumentException("Invalid GTIN/EAN value '" + value + "'.");} when value is rightfuly "40170725". GTIN is not always 14, it can be 13, an also 8 in this case : activebarcode.com/codes/ean8 Commented Jan 8 at 8:26
  • Have you considered that the ZXing Decoder Online isn't working as expected? I was able to scan the images using my phone. Commented Jan 8 at 9:44
  • 1
    If you only submit the barcode image to zxing, it decodes it as 0100000040170725. The decoder at zxing.org is not supposed to find barcodes on a full label image. Commented Jan 8 at 9:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.