Unplanned
Last Updated: 12 May 2021 15:56 by Bernie
Bernie
Created on: 10 May 2021 18:00
Category: Barcode
Type: Bug Report
1
RadBarcode producing wrong barcode

I think the radbarcode control is generating the wrong barcode. Here is my code;


            RadBarcode theControl = new RadBarcode();
            BarcodeType theType = BarcodeType.PDF417;
            theControl.Type = theType;
            theControl.PDF417Settings.AspectRatio = 10;
            theControl.PDF417Settings.ErrorCorrectionLevel = 0;
            theControl.PDF417Settings.EncodingMode = Telerik.Web.UI.Barcode.PDF417ClassLibrary.EncodingMode.Text;
            theControl.Text = clsJobBarcode.CreateNewJobString(theClass.Job, theClass.Release, theClass.Lot);
            System.Drawing.Image theImage = theControl.GetImage();
            theImage.Save(thePath + "barcode.png", System.Drawing.Imaging.ImageFormat.Png);

The file barcode.png is the output of this code. The input into the barcode is:

theLot
"20338B"
theRelease
"R320"
theJob
"A2552013"
theControl.Text
"A2552013|R343|21102A"

from a breakpoint in my code at the theImage = theControl.GetImage();

I'm reading the barcode with a Zerbra TC-20 mobile computer with a barcode reader. It says the barcode contains "A2552013|DED|21102A".

First off can you guys authenticate the attached barcode does have DED rather than R320?

If so, any ideas what I'm doing wrong?

Thanks,

Bernie

 

Attached Files:
10 comments
Bernie
Posted on: 12 May 2021 15:56

I found this page in my travels this morning;

https://docs.telerik.com/devtools/winforms/controls/barcode/barcode-types/2d-barcodes/pdf417/settings

 Based on this data it's likely not a bug but a hidden documentation feature, hahahaha.

 I agree about publish to help the next guy. Have a great week and we are ticket closed.

 

ADMIN
Eric R | Senior Technical Support Engineer
Posted on: 12 May 2021 15:53

Hi Bernie,

Thank you for your patience while we investigated this. During our investigation we also found the same issue and workaround. For clarity, let me explain the bug and workaround below. 

Bug Explanation

The bug exists in the Text encoding logic for the PDF417. Essentially,  The "|" character is treated as a "text compaction sub-mode switching" special character which alters the way characters following it are encoded. The second "|" switches the encoding back to the previous encoding.

As a result, we have logged the bug and plan to begin researching the implementation fix next week. Additionally, we are also working to synergize all of the framework barcode engines so that they work the same across each platform which will happen during future releases.

Workaround

The workaround is to change the EncodingType to Byte instead of Text.

Wrapping Up

Because there is the potential others may find this information useful, I will make this public on the AJAX Feedback Portal as well. 

Please let me know if you need any additional information. As always, we thank you for continued feedback with UI for ASP.NET AJAX.

Regards,


Eric R | Senior Technical Support Engineer
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/.

Bernie
Posted on: 12 May 2021 13:57

Houston, we have a solution! .... Note: cultural reference that may not translate, hahaha.

I played around with different formats and stumbled onto an idea. I modified your same code to change the EncodingMode on the PDF947Settings.

	<telerik:RadBarcode runat="server" ID="RadBarcode1" Type="PDF417" OutputType="EmbeddedPNG" Text="A2552013|R343|21102A" ShowText="true">
		<PDF417Settings AspectRatio="10" EncodingMode="Byte" ErrorCorrectionLevel="0" />
	</telerik:RadBarcode>
	<telerik:RadButton runat="server" ID="RadButton1" OnClick="RadButton1_Click" Text="Export Barcode Image">
	</telerik:RadButton>

That seems to do it. 

I'm attached a barcode generated by the page. Please verify my findings. 

Attached Files:
Bernie
Posted on: 12 May 2021 13:36

I just checked and the QR format code works correctly with the ASCII 124. So I'll have to use those until you guys get it sorted out.

 

Bernie

Bernie
Posted on: 12 May 2021 13:16

It's looks like your reporting products can support DataMatrix codes, 

https://docs.telerik.com/reporting/report-items-barcode-types

 

Will the ASP Ajax code also support that format?

 

Bernie

 

Bernie
Posted on: 11 May 2021 20:05

Please also check of there are other special characters that don't work.

 

Thanks,

Bernie

PS: There is an android app called PDF417 barcode scanner from Microblink that will read these.

ADMIN
Eric R | Senior Technical Support Engineer
Posted on: 11 May 2021 19:28

Hi Bernie,

My sincerest apologies, I misunderstood the second post on this issue. However, I am unable to scan the barcode with that exact scanner. As a result, I have investigated this further and believe that this is a bug. Let me review my investigation below. 

Investigation

My initial testing confirms that a scan that the Inlite Free Online Barcode Scanner states that a PDF417 barcode is not present in the original output file when I upload it. See the following screenshot for a visual reference. 

Once I add a white background to the original output file, it does produce the same results as described in the below screenshot. 

For additional testing, I was able to test generating a PDF417 barcode with that text using the Barcode Bakery demonstration and it produced the following output. 

Barcode

Read Results

Wrapping Up

I believe that this is a bug within the PDF417 barcode encoding and have converted this ticket to a bug report for further review from the development team. 

As a token of gratitude, I have added Telerik Points to your account. We will work to investigate this and provide an update as soon as possible.

In the meantime, please let me know if you need any additional information. Thank you for your continued feedback.

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Bernie
Posted on: 11 May 2021 16:10

Eric,

"Thank you for providing the resources and I am glad to hear that you were able find that the barcode control does generate the expected text."

 This is absolutely false! The barcodes generated do not work.

 I put your same code into a test page and ran it. The barcode that it generated failed. Your code has this line,  

<telerik:RadBarcoderunat="server"ID="RadBarcode1"Type="PDF417"OutputType="EmbeddedPNG"Text="A2552013|R343|21102A"ShowText="true">

 So the barcode should read as "A2552013|R343|21102A", instead it reads as "A2552013|.DED|21102A".

I have attached the file created for your review. Please scan it to verify my findings.

Please send your barcode image so I can test it on my scanners. I'm using a Zebra TC-20 for the scanning.

Bernie 

      
Attached Files:
ADMIN
Eric R | Senior Technical Support Engineer
Posted on: 11 May 2021 15:53

Hi Bernie,

Thank you for providing the resources and I am glad to hear that you were able find that the barcode control does generate the expected text. As for the issue with the "|" character, this is not possible to understand using the provided information. 

However, I created a very simple application that reproduces the behavior from my understanding. In the sample the image exported as expected and since the scanner in use is displaying the appropriate text this should be working. Let me review the sample below. 

 Sample

Instead of programmatically generating the control, I declared everything statically and included a button to save the image. See the following code snippets for reference.

Barcode and Button Markup

The markup for the barcode and the button. Note that the OutputType is declared as well. See the OutputType documentation for more information.

<telerik:RadBarcode runat="server" ID="RadBarcode1" Type="PDF417" OutputType="EmbeddedPNG" Text="A2552013|R343|21102A" ShowText="true">
    <PDF417Settings AspectRatio="10" EncodingMode="Text" ErrorCorrectionLevel="0" />
</telerik:RadBarcode>
<telerik:RadButton runat="server" ID="RadButton1" OnClick="RadButton1_Click" Text="Export Barcode Image">
</telerik:RadButton>

Barcode Save Event

The barcode save event uses a similar approach without the image format type since this is declared in the control. 

protected void RadButton1_Click(object sender, EventArgs e)
{
    System.Drawing.Image img = RadBarcode1.GetImage();

    string path = Server.MapPath("~/Barcodes/barcode.png");

    img.Save(path);
}

Wrapping Up

The above implementation does save to the ~/Barcodes path as expected and you stated that the scanner is outputting the correct text after further testing. Can you confirm using the attached sample that this works as expected as well?

To run the sample locally ensure the the Telerik NuGet Feed is Configured in Visual Studio. If there are issues with the NuGet Restore, execute update-package -reinstall from the Package Manager Console.

Please let me know if you have any issues with the sample or if you need any additional information. Thank you for being a valued UI for ASP.NET AJAX developer.

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Attached Files:
Bernie
Posted on: 10 May 2021 18:19

Further testing has shown that it appears to be a problem with the vertical bar characters, "|", ascii code 124 in decimal. I ran some test code using an asterick, "*" and it produced barcodes that read as expected. I've found various specifications for PDF417 barcodes and they all agree that the ASCII 128 character is all allowed in a PDF417 image. Obviously character number 124 would be in the 128, hahaha.

Is this possible there is a problem with using the "|" character?