pq scan
Answer:
Hi, Quincy.
To make things simple, you only need add two web controls into the aspx page. One is FileUpload control, the other is Button.
You can use the FileUpload control to upload the barcode image files in the asp.net application. In addition, you can insert a Image web control to the aspx page, after the barcode image uploaded, make this web Image control to display the barcode image dynamically. Please note, if you want to show this barcode image instant by ajax technique, you need use the UpdatePanel provided by Microsoft. Just insert the web Image into the UpdatePanel, the Image control can refresh immediately while the upload barcode image changed.
Then while you clicking the button, you can define the customized click event in the aspx.cs. Such as reading and scanning barcode feature can be added in this server side event.
Here we post the main sample C# code in the asp.net web page. You can make your own web application just like this. Please add the "PQScan.BarcodeScanner.dll" to your project reference.
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PQScan.BarcodeScanner;
namespace BarcodeReaderWebDemo
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btUpload_Click(object sender, EventArgs e)
{
string name = this.FileUpload1.FileName;
string path = Server.MapPath("UploadFiles") + "\\" + name;
if (System.IO.File.Exists(path))
{
System.IO.File.Delete(path);
}
FileUpload1.SaveAs(path);
Session["filepath"] = path;
}
protected void btRead_Click(object sender, EventArgs e)
{
string result = "";
string path = Session["filepath"].ToString();
BarcodeResult[] barResults = BarCodeScanner.Scan(path);
if (barResults != null)
{
result = "";
for (inti = 0; i<barResults.Length; i++)
{
result += barResults[i].BarType.ToString() + " -- " + barResults[i].Data + "\r\n";
}
}
this.TextBox1.Text = result;
}
}
}
Hope the C# code can be helpful.
---- pqScan Support Team