2D Barcodes and "national characters" problem

Discussions about barcode reading and writing
Post Reply
Halla602
Posts: 8
Joined: Wed Jan 02, 2013 4:59 pm

2D Barcodes and "national characters" problem

Post by Halla602 » Fri May 03, 2013 10:01 am

Hi, when I try to generate PDF417, QR or DataMatrix and in the "data" I have special national characters, specifically " ť ď ľ ň ě š č ř ž ý á í é ó ú ", the Barcodes sometimes do get generated, but most of the times return an error / the generated output is not readable.

The other issue is, when I the QRGetSize function, for this input it gives me version == 5, but when I use this version, I get the "BarcodeQrEncoderInvalidVersionBarcode" error, so I had to use the value 0 for the generating function. When the input is purely english characters, everything works fine and I can use the version I get from GetSize function.

I attach an output PDF, where I try to generate all three of them using " ť ď ľ ň ě š č ř ž ý á í é ó ú " as the input data.

Code: Select all

          if (type == Barcode_Subtype.Barcode_QR)
          {
            int version = 0;
            int size = Imaging.BarcodeQRGetSize(Data, BarcodeQREncodingMode.BarcodeQREncodingModeUndefined, BarcodeQRErrorCorrectionLevel.BarcodeQRErrorCorrectionLevelH, ref version, 4, 4);            

            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(size, size);
            Image_ID = Imaging.CreateGdPictureImageFromBitmap(bitmap);

            status = Imaging.BarcodeQRWrite(Image_ID, Data, BarcodeQREncodingMode.BarcodeQREncodingModeUndefined, BarcodeQRErrorCorrectionLevel.BarcodeQRErrorCorrectionLevelH, 0, 4, 4, 0, 0, 0, System.Drawing.Color.Black, System.Drawing.Color.White);
          }

          else if (type == Barcode_Subtype.Barcode_PDF417)
          {
            int width = 0;
            int height = 0;
            int cols = 0;
            int rows = 0;
            BarcodePDF417ErrorCorrectionLevel corr_level = BarcodePDF417ErrorCorrectionLevel.BarcodePDF417ErrorCorrectionLevelAuto;
            status = Imaging.BarcodePDF417GetSize(Data, BarcodePDF417EncodingMode.BarcodePDF417EncodingModeUndefined, ref corr_level, ref rows, ref cols, 4, 4, 15, ref width, ref height);

            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(width, height);
            Image_ID = Imaging.CreateGdPictureImageFromBitmap(bitmap);
            status = Imaging.DrawFilledRectangle(Image_ID, 0, 0, width, height, System.Drawing.Color.White, false);

            status = Imaging.BarcodePDF417Write(Image_ID, Data, BarcodePDF417EncodingMode.BarcodePDF417EncodingModeUndefined, corr_level, rows, cols, 4, 4, 15, 0, 0, 0, System.Drawing.Color.Black, System.Drawing.Color.White);
          }

          else if (type == Barcode_Subtype.Barcode_DataMatrix)
          {
            BarcodeDataMatrixVersion version = BarcodeDataMatrixVersion.BarcodeDataMatrixVersionAuto;
            int width = 0;
            int height = 0;

            status = Imaging.BarcodeDataMatrixGetSize(Data, BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeUndefined, ref version, 4, 4, ref width, ref height);

            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(width, height);
            Image_ID = Imaging.CreateGdPictureImageFromBitmap(bitmap);

            status = Imaging.DrawFilledRectangle(Image_ID, 0, 0, width, height, System.Drawing.Color.White, false);
            status = Imaging.BarcodeDataMatrixWrite(Image_ID, Data, BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeUndefined, ref version, 4, 4, 0, 0, 0, System.Drawing.Color.Black, System.Drawing.Color.White);
          }
The code for reading barcodes is the same as you use in your samples, like I said, it works on english characters without any problems. I also attached the output file, using the same code, when I use only english letters. Here is the output I get from my ReadBarcode function on the good output:

Code: Select all

BarCode #1 - Barcode1DReaderEAN13:
8594160390009:
BarCode #2 - PDF417:
This is text in the PDF417:
BarCode #3 - QR Code:
This is text in the QR code:
BarCode #4 - Data Matrix:
This is text in the Data Matrix:
*Edit - I just found out, that in case of DataMatrix and PDF417, the codes seem to be fine, just the way I try to read them seems to have problems - might be just different encoding of the string and I might be able to fix this, so, that doesn't seem to be an issue now, just a problem with the way my solution is writen. However, if you can point me towards how to find out what encoding is used and how to convert it to right input, that would be great.
However, the QR code generation is not working, which you can clearly see in the output file.
Attachments
Barcodes.zip
(23 KiB) Downloaded 406 times

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: 2D Barcodes and "national characters" problem

Post by Loïc » Wed May 08, 2013 10:49 pm

Hello Halla,

Sorry for the delay. Could you please open an incident through our helpdesk located here: https://www.gdpicture.com/support/getting-support-from-our-team

There is obviously 2 different problems which involve escalation from our side.

Thank you for your understanding.

With best regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest