Question

I'm scanning documents with WIA. All works good but scanning page result is not A4 format. How to say WIA to scan whole document? When I scan, page result is cropped to Letter format. Here is code:

 WIA.Item Item = _scannerDevice.Items[1] as WIA.Item;
 WIA.ImageFile wiaImage = null;
 Item.Properties["6147"].set_Value(dpi);
 Item.Properties["6148"].set_Value(dpi);
 //start from x=0; y=0;
 Item.Properties["6149"].set_Value(0);
 Item.Properties["6150"].set_Value(0);

 Item.Properties["6151"].set_Value(width);
 Item.Properties["6152"].set_Value(height);
 wiaImage = (ImageFile)_scannDialog.ShowTransfer(Item, wiaFormatJPEG, false);                      
 if (wiaImage.FileData != null)
   {
       WIA.Vector vector = wiaImage.FileData;
      _image = Image.FromStream(new MemoryStream((byte[])vector.get_BinaryData()));
       OnScannComplete(_image);
  }
Was it helpful?

Solution

I suspect that you need to use the appropriate properties for Page sizes.

You need to set WIA_IPS_PAGE_SIZE (ID 3097) to 0 (which means A4).

For some samples/source to set the page size to A4 see:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top