ASP.NET Barcode SDK Component

ASP.NET 2019 Developer Getting Started

1. Assuming that you have already run the ASP.NET Barcode SDK Component installation program and started visual studio 2019, the next step is create a new project, select ASP.NET Web Application(.NET Framework). Click Next.



2. Select Empty - selected Web Forms , click Create button.



3. In Solution Explorer, selected References, right click the mouse, select Add Reference... , select Browse, select BarcodeWrapper.dll and PDFWrapper.dll from
C:\Program Files (x86)\ASP.NET Barcode SDK Component\bin folder, then click OK.



4. Select WebApplication1 in Solution Explorer, right click the mouse, select Add - New Items... , select Web Form, enter the Default.aspx name.
then click Add.



5. Select WebApplication1 in Solution Explorer, right click the mouse, select Add - New Folder, rename the folder to uploads and add barcode sample image named barcodetest.jpg in this folder.



6. Open Default.aspx.cs, add the following import statements to the top of the page.
using  System.Web.Services;
using  System.Drawing;
using  System.Drawing.Imaging;
using  BarcodeWrapper;




7. Add ReadBarcodeImage function and Create an instance of ASP.NET Barcode SDK Component and then read the multiple barcode.
[WebMethod]
 public static void ReadBarcodeImage(string strInputFile)
{
BarcodeReader reader = new BarcodeReader();
reader.ScanWithoutRotation = true;
reader.ScanWith45DegreeClockwiseRotation = true;
reader.ScanWith45DegreeCounterClockwiseRotation = true;
reader.ScanWith90DegreeRotation = true;
reader.TryHard = true;
reader.ScanMultiple = true;
string strinputpath = HttpContext.Current.Server.MapPath("~/uploads/" + strInputFile);

Bitmap bitmap = new Bitmap(strinputpath);
int width = bitmap.Width;
int height = bitmap.Height;
int count = reader.ReadBarcodeImage(bitmap, 0, 0, width, height);

string text = "" + count + " codes found<br><br>";

for (int i = 0; i < count; i++)
{
   text += reader.GetBarCodeType(i) + " value:" + reader.GetBarCodeValue(i) + "<br>";
}
HttpContext.Current.Response.Write(text);
}



8. add the following code in Page Load event,it will read the barcode from image.
protected void Page_Load(object sender, EventArgs e)
{
  ReadBarcodeImage("barcodetest.jpg");
}


 

9. Press F5 run the project, it will read the barcode from image.