title: Scan multiple pages using WIA automation
body: <p>I'm playing around with WIA Automation and I`m struggling to scan more than page at a time. Can anyone give me some hints on how to achieve this? Below is a sample of code I use to scan a document/image:</p>
  
  <pre><code>public static byte[] ScanImage(int colourType, string formatId, int dpi)
      {
        _dialog = new CommonDialogClass();
        _scanner = _dialog.ShowSelectDevice(WIA.WiaDeviceType.ScannerDeviceType, false, false);     
  
    foreach (Property item in _scanner.Items[1].Properties)
    {
      switch (item.PropertyID)
      {
        case 6146: //4 is Black-white,gray is 2, colour 1   
          SetProperty(item, colourType);
          break;
        case 6147: //dots per inch/horizontal    
          SetProperty(item, dpi);
          break;
        case 6148: //dots per inch/vertical          
          SetProperty(item, dpi);
          break;
        case 6149: //x point where to start scan   
          SetProperty(item, 0);
          break;
        case 6150: //y-point where to start scan  
          SetProperty(item, 0);
          break;
        case 6151: //horizontal extent        
          SetProperty(item, (int)(8.5 * 100));
          break;
        case 6152: //vertical extent             
          SetProperty(item, 11 * 100);
          break;
      }
    }
  
    try
    {
      TempPath = System.IO.Path.GetTempPath() + "temp" + DateTime.Now.Ticks;
  
      ScannedImage = (ImageFile)_scanner.Items[1].Transfer(formatId);
      //System.IO.File.Delete(TempPath);
      ScannedImage.SaveFile(TempPath);
  
      //Convert image to binary
      Vector vector = ScannedImage.FileData;
      byte[] imgBin = (byte[])vector.get_BinaryData();
      ScannedImageBinary = (byte[])vector.get_BinaryData();
  
      //ImageFromFile = Image.FromFile(TempPath);
    }
    catch (Exception ex)
    { }
  
    return ScannedImageBinary;
  }
  </code></pre>