You have to know that this kind of operation is only leveraged within windows XP environment, moreover, the WIA API is not automatically delivered with Windows; therefore, it must be downloaded from this link.
First, install the WIA API by extracting the content of the zipped file then by copying and pasting the wiaaut.dll assembly to C:\Windows\System32 and finally by registering the assembly using the regsvc32.exe
Now, include the WIA library within your project by adding a reference to it :
Add a new class to your project and name it Scanner:
public class Scanner
dlg = new CommonDialogClass();
oDevice = dlg.ShowSelectDevice(WiaDeviceType.ScannerDeviceType, true, false);
public void Scann()
In order to consume the services of this very simple class add a button and a picture box to your form as your project is Windows form one, the form should looks like this bellow:
Do implement the button1_click as follow:
private void button1_Click(object sender, EventArgs e)
Scanner oScanner = new Scanner();
button1.Text = "Image scanned";
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
pictureBox1.Image = Image.FromFile(dlg.FileName);
Now run the application and observe:
Then the below windows appears :
Choose the colored photo, and then click next:
In the above window, select JPG then click next
Figure 8 .
As showed above, the scanning process will be lunched as normally, click next then finish and the paper will be scanned as bellow:
You can browse to the emplacement of the given scanned image and display it using the picture box.
God Dotneting !!!