4 Answers, 1 is accepted
You can find below a sample code snippet demonstrating how to export a RadBarcode as an image without actually showing it on the form:
private
void
radButton1_Click(
object
sender, EventArgs e)
{
RadBarcode radBarcode1 =
new
RadBarcode();
Telerik.WinControls.UI.Barcode.Symbology.Code39Extended code39Extended1 =
new
Telerik.WinControls.UI.Barcode.Symbology.Code39Extended();
radBarcode1.Symbology = code39Extended1;
radBarcode1.Value =
"123456"
;
radBarcode1.LoadElementTree();
string
fileName = @
"..\..\exported.png"
;
Image img = radBarcode1.ExportToImage();
img.Save(fileName, System.Drawing.Imaging.ImageFormat.Png);
Process.Start(fileName);
}
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess
Progress Telerik
Hello,
how can we specify the barcode size like this? Using the parameters for `ExportToImage` the image size changes, but not the size of the barcode itself (at least not the width)...
Kind regards.
Hello, Stefan,
The ExportToImage method has several overloads which allow you to specify the size of the exported image. Thus, you can control how big the bar code image will be.If I understand your question correctly you would like to specify the size of the RadBarcode itself. To achieve this you can use the Width and Height properties:
RadBarcode radBarcode1 = new RadBarcode();
radBarcode1.Width = 50;
radBarcode1.Height = 50;
I hope this helps. Should you have other questions please let me know.
Regards,
Nadya
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/.
this doesn't seem to work for us properly. I'll create a new thread for this, so that I can attach files/images...
Kind regards.
Hi, Stefan,
I have attached a sample project for your reference. The following image is obtained on my end:
I will have a look at the other ticket as well and we can discuss the scenario further.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Тhe web is about to get a bit better!
The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.