2 Answers, 1 is accepted
Hello Ohad,
Thank you for your patience with this.
I was able to dig into our QR code's source code and found that it requires a specific setup to be able to encode Hebrew. The settings in question are the CodeMode set to Byte and the ECIMode set to Unicode. Here is my test code:
<telerik:RadBarcode x:Name="barcode" Value="משלך באמצעות מחולל קוד">
<telerik:RadBarcode.Symbology>
<telerik:QRCode SizingMode="Snap" CodeMode="Byte" ECIMode="UTF8" />
</telerik:RadBarcode.Symbology>
</telerik:RadBarcode>
If there is anything else I can help you with, feel free to write back.
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/.
Thank you.
With RadBarcodeQR I was able to display it with its Text bounded to an empty string.
But with the RadBarcode when its value is bounded to an empty string it is not displayed.
Is it possible to display the RadBarcode even though it is bound to an empty string?
Is there a way to create RadBarCode through the Code behind without displaying it in the UI
and giving it Symbology like you gave here in the example above and printing it?
Thanks,
Yes,
for example, I want to show the user a BarCode in size 10x10 and white but when I want to print it I want to print when it has a
white background and the barcode itself is black and its size is 50x50
After some experimenting, I found a somewhat hacky solution. It consists of creating an off-screen window with a barcode on it and then exporting this barcode to a file.
Here is what it looks like in code:
RadBarcode bc = new RadBarcode()
{
Value = "Example text",
Width = 400,
Height = 400,
Symbology = new QRCode()
{
SizingMode = SizingMode.Stretch,
CodeMode = CodeMode.Byte,
ECIMode = ECIMode.UTF8
}
};
Window w = new Window()
{
WindowStartupLocation = WindowStartupLocation.Manual,
Content = bc
};
w.Top = -w.Height;
w.Show();
string extension = "png";
SaveFileDialog dialog = new SaveFileDialog()
{
DefaultExt = extension,
FileName = "QRBarCode",
Filter = "Png (*.png)|*.png"
};
if (dialog.ShowDialog() == true)
{
using (Stream stream = dialog.OpenFile())
{
Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(bc, stream, new PngBitmapEncoder());
}
}
w.Close();
If you have any questions, do not hesitate to write back.
Hello Ohad,
I was not able to read a QR code that contained Hebrew text. I will do some more research as both Unicode and Ascii contain Hebrew characters. I'll come back to you when I have more info.