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;
}