New RadBarcode control doesn't work as old control

3 Answers 228 Views
BarCode General Discussions
Aleksey
Top achievements
Rank 1
Veteran
Iron
Aleksey asked on 28 May 2021, 06:42 AM

Hello,

we have old code for generate label with barcode Code39

var barcodeBox = new RadBarcode39
{
 Text = "2015-19541",
 RenderChecksum = false,
 ShowChecksum = false,
 ShowText = false,
 Width = 192,
 HorizontalAlignment = HorizontalAlignment.Center,
 VerticalAlignment = VerticalAlignment.Stretch,
 Margin = new Thickness(5, 0, 5, 0),
}; 

and have result https://ibb.co/3hgJHCw

after upgrade to new control with code

var barcodeBox = new RadBarcode
{
 Value = "2015-19541",
 Width = 192,
 HorizontalAlignment = HorizontalAlignment.Center,
 VerticalAlignment = VerticalAlignment.Stretch,
 Margin = new Thickness(5, 0, 5, 0),
 Symbology = new Code39()
 {
  AutoChecksum = false,
  ShowText = false,
  SizingMode = SizingMode.Stretch
 }
};

we have result https://ibb.co/k8hPdLp

Old barcode we can scan, but new barcode we cannot scan

3 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 01 Jun 2021, 10:21 AM

Hello Aleksey,

Thank you for the provided code, it helps get straight into testing the case.

The new barcode uses a different means for drawing to the screen which is faster and more accurate. After some tests, I can confirm that both the old and new barcodes produce the same result when encoding the value you have provided "2015-19541". This means that there is a difference in the drawing that causes difficulty with scanning. In my case using your setup, I had mixed results with both the old and new barcodes when scanning. The change that led to reliable scanning on my end and my suggestion to you is to use the SizingMode.Snap. I have attached a screenshot where the same barcode is magnified by 500%. The top one is with SizingMode.Stretch and the bottom one is with SizingMode.Snap. You can see the difference in the clarity, the lower barcode has clear, crisp, well-defined lines which makes it easy to scan. The upper one has gray areas that cause problems in most cases when a barcode is hard to scan or outright unscannable. Depending on the screen settings, like brightness and tone, these gray areas can be interpreted by a scanner as black or white, making the barcode invalid. When dealing with limited space it is always advisable to use the snap sizing mode as the stretch one can cause layout rounding that can change the scanned value.

Here is your code snippet with the change marked in bold:

var barcodeBox = new RadBarcode
{
 Value = "2015-19541",
 Width = 192,
 HorizontalAlignment = HorizontalAlignment.Center,
 VerticalAlignment = VerticalAlignment.Stretch,
 Margin = new Thickness(5, 0, 5, 0),
 Symbology = new Code39()
 {
  AutoChecksum = false,
  ShowText = false,
  SizingMode = SizingMode.Snap
 }
};

I hope this is useful. Should you have further questions, I would be glad to help.

Regards,
Ivan Petrov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Aleksey
Top achievements
Rank 1
Veteran
Iron
answered on 02 Jun 2021, 07:06 AM

Hello, Ivan,

Thank you  for your answer, but SizingMode.Snap is not useful for us, because we need fixed width barcode and centered.

You can see new result https://ibb.co/4mfsx7X  - barcode aligned left always and has small width.

I think, new RadBarcode control cannot generate readable barcode for small fixed width with SizingMode.Stretch.

So, we are continue to using old RadBarcodeCode39 control. 

Ivan Petrov
Telerik team
commented on 03 Jun 2021, 12:29 PM

Hi Aleksey,

Our intention with the new barcode was to cover all cases the old one does. The fact that It does not fully work in your case means there is room for improvement in the new one. 

Here are some thoughts I have. Since the Code 39 barcode is of variable length by definition where does the requirement for fixed-width come from in your project? Scanners would rarely have size constraints for the barcodes they are scanning. Is this a UX/design/aesthetic requirement? Also, if the barcode, with size mode snap, is centered within the space provided, would that be a viable solution for you? What other requirements for the barcode are there in your project? Answering these questions will allow me to better assist you in achieving the desired result.

Aleksey
Top achievements
Rank 1
Veteran
Iron
commented on 08 Jun 2021, 03:36 AM | edited

Hi Ivan,

Thanks for your comment, yes, we want a centered barcode, but we also want to use at least 80% of the filled label, because our client doesn't want to print blank labels. The customer want to set himself the width of the barcode on the label.
Ivan Petrov
Telerik team
commented on 10 Jun 2021, 10:51 AM

Hi Aleksey,

I've been digging around the barcode and trying to find a way to improve the new barcode so your case would work. I noticed that the UseLayoutRounding property of the RadBarcode control has its default value of false and switching it to true improves the crispness of the barcode in stretch mode massively. Could you try setting the UseLayoutRounding property of the control in your code to true and see whether this improves the readability on your end?

Aleksey
Top achievements
Rank 1
Veteran
Iron
commented on 11 Jun 2021, 04:09 AM | edited

Hi Ivan,

I set UseLayoutRounding = true, but it did not work for us.
We cannot scan barcode https://ibb.co/F6FHqLL
Ivan Petrov
Telerik team
commented on 15 Jun 2021, 01:52 PM

Hi Aleksey,

I was curious whether the following is a workable solution for you. The width of the barcode in SizeMode.Snap is exactly 155px. Your available space is 192px. 155 is just a little bit over 80% of 192. If the barcode is centered will it be a viable solution for you to use SizeMode.Snap?

Aleksey
Top achievements
Rank 1
Veteran
Iron
commented on 17 Jun 2021, 10:09 AM

Hi Ivan,

I think, you should add centered for all modes and fix SizeMode.Stretch, because my test value "2015-19541" is just an example for you and client can have any other values.
Ivan Petrov
Telerik team
commented on 22 Jun 2021, 09:20 AM

Hi Aleksey,

I have logged a feature request in our Public Feedback Portal for an alignment mechanism under the following link. You can use it to vote, comment, and/or subscribe for status change alerts. I have also updated your Telerik Points for this request.

I'll conduct some more tests on the readability of the barcode and see what can be done there.

0
Jan
Top achievements
Rank 1
Iron
answered on 06 Mar 2023, 08:59 PM
I feel your pain about the new RadBarcode control not working as well as the old one. That's a bummer!
Martin Ivanov
Telerik team
commented on 07 Mar 2023, 07:20 AM

If you mean the alignment behavior discussed previously in this thread, that was improved back in 2021 by making the barcode control to respect its HorizontalContentAlignment property. You can give it a try and see if it works for you.

In case you experience any other issues, can you please share these?

Tags
BarCode General Discussions
Asked by
Aleksey
Top achievements
Rank 1
Veteran
Iron
Answers by
Ivan Petrov
Telerik team
Aleksey
Top achievements
Rank 1
Veteran
Iron
Jan
Top achievements
Rank 1
Iron
Share this question
or