I want to scan a document from my web application using javascript.
How can I do this.

After a long Research i found this code to Scan a document using WiaClass in ASP.NET

WiaClass wiaManager = null;		// WIA manager COM object
CollectionClass wiaDevs = null;		// WIA devices collection COM object
ItemClass wiaRoot = null;		// WIA root device COM object
CollectionClass wiaPics = null;		// WIA collection COM object
ItemClass wiaItem = null;		// WIA image COM object
try
    {
      string fileName = "myFile";
      wiaManager = new WiaClass();	// create COM instance of WIA manager

  wiaDevs = wiaManager.Devices as CollectionClass;// call Wia.Devices to get all devices

   if ((wiaDevs == null) || (wiaDevs.Count == 0))
   {
        Response.Write("<script>alert('No Scanner found');</script>");
        return;
   }
   else
   {
       object selectUsingUI = System.Reflection.Missing.Value;			
       wiaRoot = (ItemClass)wiaManager.Create(ref selectUsingUI);//letUser select device
       
     if(wiaRoot == Null	)
        return;

    // this call shows the common WIA dialog to let the user select a picture:
     wiaPics = wiaRoot.GetItemsFromUI(WiaFlag.SingleImage, WiaIntent.ImageTypeColor) as     CollectionClass;
              
      if (wiaPics == null)
            return;
      bool takeFirst = true;	         // this sample uses only one single picture
      string ImgName = Server.MapPath("~\\thumbnails").ToString() + "\\" + fileName;
    
     foreach (object wiaObj in wiaPics)	// enumerate all the pictures the user selected
      {
          if (takeFirst)
          {
          wiaItem = (ItemClass)Marshal.CreateWrapperOfType(wiaObj, typeof(ItemClass));
          // transfer picture to our temporary file
          wiaItem.Transfer(ImgName + ".jpg", false); 
          makeThumbnail(fileName + ".jpg");        
     takeFirst = false;								
    }
    Marshal.ReleaseComObject(wiaObj);		
   }
}
}
catch (Exception ee)
{
}
finally
(
if (wiaItem != null)
    Marshal.ReleaseComObject(wiaItem);		// release WIA image COM object
if (wiaPics != null)
    Marshal.ReleaseComObject(wiaPics);		// release WIA collection COM object
if (wiaRoot != null)
    Marshal.ReleaseComObject(wiaRoot);		// release WIA root device COM object
if (wiaDevs != null)
    Marshal.ReleaseComObject(wiaDevs);	// release WIA devices collection COM object
if (wiaManager != null)
    Marshal.ReleaseComObject(wiaManager);	// release WIA manager COM object
}
commented: can you tell me more how you did that? +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.