I have a C# (WinForm) program that supports scanning using WIA. I am trying to set device properties before scanning one or more documents. Primarily I want to set the paper size for the scanner. Following is a snippet of the code:
foreach (Property property in selectedDevice.Properties)
{
//WiaProperties.WiaDpsHorizontalBedSize is my constant
if (property.PropertyID == WiaProperties.WiaDpsHorizontalBedSize)
{
//Set property value here...
}
}
I am finding the Horizontal Bed Size property, but the question is how do I set it to a value? There is a set_Value property off of property but that seems to take a ref to a result object. So I am at a loss as to how can I set properties on a device?
I am working on a scanning project as well, and there are very few WIA examples. This code is what you are looking for to set the bed size, DPI, etc. Check out the SetProperty method with an example on how to deal with set_Value.