Telerik.WinControls.UI.Barcode QR could not read it in IOS smartphones

1 Answer 15 Views
Barcode BarcodeView
n/a
Top achievements
Rank 1
n/a asked on 18 Mar 2025, 08:10 PM

Hi everyone, i use Telerik.WinControls.UI.Barcode to generate QR and every thing is fine with android reads, but IOS read said No usable data found.  Could you help me? This is my code

private void PrintDoc_PrintPage(object sender, PrintPageEventArgs e)
{
    printDoc.DefaultPageSettings.PaperSize = new PaperSize("Etiqueta5", 300, 150);
    printDoc.DefaultPageSettings.Landscape = true;

    float leftMargin = e.MarginBounds.Left;
    float topMargin = e.MarginBounds.Top;
    float printableWidth = e.MarginBounds.Width;
    float printableHeight = e.MarginBounds.Height;

    float labelWidth = 300; 
    float labelHeight = 150;



    float qrSize = 150;
    float margin = 3; 

    Font font = new Font("Arial", 9, FontStyle.Bold);
    Font smallerFont = new Font("Arial", 8, FontStyle.Bold);
    Brush brush = Brushes.Black;

    while (_currentRowIndex < dgv_resultado.Rows.Count)
    {
        DataGridViewRow row = dgv_resultado.Rows[_currentRowIndex];

        
        string idBien = row.Cells["IDBien"].Value?.ToString() ?? "N/A";
        string url = "http://www.mypage.com/";
        string articulo = row.Cells["Articulo"].Value?.ToString() ?? "N/A";
        string serie = row.Cells["NumSerie"].Value?.ToString() ?? "N/A";
        string fondos = ObtenerFondos(idBien);
        string contraloria = "";
        if (bandera == 0)
        {
            contraloria = row.Cells["NumContraloria"].Value?.ToString() ?? "N/A";
        }
        else 
        {
            contraloria = row.Cells["NoContraloria"].Value?.ToString() ?? "N/A";
        }

        string qrData = $"IdBien:{idBien}|Liga:{url}|Artículo:{articulo}|Serie:{serie}|Fondos:{fondos}|Contraloría:{contraloria}";


        byte[] utf8Bytes = Encoding.UTF8.GetBytes(qrData);
        string qrDataUtf8 = Encoding.UTF8.GetString(utf8Bytes);

        rbv_code.Value = qrDataUtf8;

        Bitmap qrImage = new Bitmap(rbv_code.Width, rbv_code.Height);
        rbv_code.DrawToBitmap(qrImage, new Rectangle(0, 0, qrImage.Width, qrImage.Height));

        float xStart = (e.PageBounds.Width - labelWidth) / 2;  
        float yStart = 0; 

        float qrXPosition = xStart + (labelWidth - qrSize) / 2;
  
        e.Graphics.DrawImage(qrImage, qrXPosition, yStart + margin, qrSize, qrSize);

        float textYPosition = yStart + qrSize + (2 * margin);
        string unisonText = "My Page";
        SizeF unisonSize = e.Graphics.MeasureString(unisonText, font);
        e.Graphics.DrawString(unisonText, font, brush, xStart + (labelWidth - unisonSize.Width) / 2, textYPosition);

        textYPosition += 15; 

        try
        {
            PostDataToApiNormal(Convert.ToInt32(idBien), Empleado);
        }
        catch { }
        

        string idBienText = $"ID: {idBien}";
        SizeF idBienSize = e.Graphics.MeasureString(idBienText, smallerFont);
        e.Graphics.DrawString(idBienText, smallerFont, brush, xStart + (labelWidth - idBienSize.Width) / 2, textYPosition);

       

        if (pb_logo.Image != null)
        {
            float imageHeight = 35; 
            float imageWidth = 35; 
            float imageXPosition = xStart + (labelWidth - imageWidth) / 2; 
            float imageYPosition = textYPosition + 20; 
            

            for (float offset = -0.5f; offset <= 0.5f; offset += 0.5f)
            {
                e.Graphics.DrawImage(pb_logo.Image, imageXPosition + offset, imageYPosition + offset, imageWidth, imageHeight);
            }
        }

        

        _currentRowIndex++;
        if (_currentRowIndex < dgv_resultado.Rows.Count)
        {
            e.HasMorePages = true;
            return;
        }
    }

    e.HasMorePages = false;
}

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 20 Mar 2025, 09:13 AM

Hello, Alfonso,

I noticed there is a ticket on the same topic but submitted from a different account in our internal system. I assume these two profiles are related. Your question has already been answered in the other thread opened on the same topic. Please, see our answer in Ticket ID: 1682292 for more information. The ticket can be found in the relevant Telerik account where it was posted.

Thank you for understanding.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Tags
Barcode BarcodeView
Asked by
n/a
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or