Setting page size for scanning in WIA 2.0

I have a business card. I am using WIA 2.0 for interoperability. I am trying to install everything in the code so that I do not need to pop up dialog boxes. The problem I have is related to setting the scan page size. The scanner is about 4 inches wide, but I can't get it to scan the right inch or so on the bed. I would set the PAGE_SIZE property, but I do not see this property when repeating all the properties that WIA has for this scanner (device or element properties).

If I pulled up the dialog box ( ShowSelectDialog ) to select the size, everything seems to work fine. I compared the properties of an element and a device before and after this dialog, and the only properties that I see are read-only changes according to MSDN. (Horizontal and vertical size, length, starting position)

Any ideas on how else I could resize the page?

+3
source share
1 answer

You can try setting values ​​in the Item property, for example,

double _width = 2; //two inches
double _height = 2; //two inches

 dynamic item = device.Items[1]; // get the first item

 int dpi = 150;

                    item.Properties["6146"].Value = 2; //greyscale
                    item.Properties["6147"].Value = dpi;
                    item.Properties["6148"].Value = dpi;
                    item.Properties["6151"].Value = (int)(dpi * _width);
                    item.Properties["6152"].Value = (int)(dpi * _height);

This worked for me when I needed to scan an A3 sheet.

0
source

Source: https://habr.com/ru/post/1762330/


All Articles