Generate QR Code in C#
- I am using a third party dll named as Zxing. It’s Originally developed in java platform.
- We can specify the Height and Width of generated QR image.
- I have attached the dll for you to download.
- We can also generate other codes such as MAXICODE,UCP and so on.
- private void Form1_Load(object sender, EventArgse)
- {
- Bitmap img = GenerateQR(50, 50, "Becauset he DataContext class is the entry point to the LINQ-to-SQL data model");
- img.Save(@"D:\TESTING FROM APPS c#/hari.bmp");// Give the path to save the generated bitmap image
- }
- public Bitmap GenerateQR(int width, int height, stringtext)
- {
- var bw = new ZXing.BarcodeWriter();
- var encOptions = new Xing.Common.EncodingOptions() { Width= width, Height = height, Margin = 0 };
- bw.Options= encOptions;
- bw.Format =ZXing.BarcodeFormat.QR_CODE;
- var result = new Bitmap(bw.Write(text));
- return result;
- }

Join the conversation! Your thoughts help the community grow.