1

I have created one web application using MVC Framework, we want to generate multiple barcode for Item, each and every barcode should be unique. we are using Asp.net c# MVC 5.0 Without Image and External Fonts. Thanks

6
  • Do you want to create an onscreen barcode without using fonts or images? Commented Jan 31, 2019 at 10:58
  • 1
    Like this: jqueryscript.net/other/… ? Commented Jan 31, 2019 at 10:59
  • 1
    Why dont you use @Neil suggested ? or do you want a C# solution ? Commented Jan 31, 2019 at 11:04
  • 1
    "... i want to generate without any 3rd party exe" why? Commented Jan 31, 2019 at 11:38
  • 1
    If you don't want to use any 3rd party libraries, then I suggest you start looking at wikipedia on how barcodes work and then get the ISO documents, then you can use GDI+ to draw lines on a Graphics surface. Good luck ! Commented Jan 31, 2019 at 13:11

1 Answer 1

1

Let's take a look step by step.

Step 1: Download QRCODE GENERATOR LIBRARY from onbarcode.com.

Step 2: Open Visual Studio - Create New Project - Windows Form.

Step 3: Add reference to OnBarcode.Barcode.Winforms.dll.

Step 4: Design form with some input fields for accepting data to encode and the targeted location to save barcode generated image.

Step 5: To generate Barcode as well as Qrcode images write two differen methods as follows.

 private void GenerateBacode(string _data, string _filename) { Linear barcode = new Linear(); barcode.Type = BarcodeType.CODE11; barcode.Data = _data; barcode.drawBarcode(_filename); } private void GenerateQrcode(string _data, string _filename) { QRCode qrcode = new QRCode(); qrcode.Data = _data; qrcode.DataMode = QRCodeDataMode.Byte; qrcode.UOM = UnitOfMeasure.PIXEL; qrcode.X = 3; qrcode.LeftMargin = 0; qrcode.RightMargin = 0; qrcode.TopMargin = 0; qrcode.BottomMargin = 0; qrcode.Resolution = 72; qrcode.Rotate = Rotate.Rotate0; qrcode.ImageFormat = ImageFormat.Gif; qrcode.drawBarcode(_filename); } 

Conclusion:

In this way you can generate barcode and qrcode images in C#. Output will look like bellow

Barcode: https://i.sstatic.net/EhzBE.png

Qrcode: https://i.sstatic.net/EhzBE.png

Sign up to request clarification or add additional context in comments.

1 Comment

No 3rd party libraries allowed !

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.