ASP.NET 2010 Developer Getting Started
|
ASP.NET 2010 Developer Getting Started |
1. Assuming that you have already run the ASP.NET Barcode SDK Component installation program and started visual studio 2010, the next step is create a new project, select ASP.NET Empty Web Application. Click OK.

2. 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.

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

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

5. 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;

6. 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);
}
9. 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");
}
10. Press F5 run the project, it will read the barcode.
