开发者

Set page size when scanning in WIA 2.0

开发者 https://www.devze.com 2023-01-14 08:04 出处:网络
I have a business card scanner I\'m using WIA 2.0 to interface with.I\'m trying to set everything up in code so that I don\'t have to pop any dialog boxes.The issue I\'m having has to do with setting

I have a business card scanner I'm using WIA 2.0 to interface with. I'm trying to set everything up in code so that I don't have to pop any dialog boxes. The issue I'm having has to do with setting the scanning page size. The scanner is about 4" wide but I can't get it to scan the right-most inch or so of it's bed. I would set the PAGE_SIZE property but I don't see that property when iterating through all the properties WIA has for that scanner (Device or Item properties).

If I pop a dialog box up (ShowSelectDialog) to select the size everything seems to work fine. I've compared the properties on the Item and Device before and after that dialog and the only properties I see changi开发者_开发百科ng are read-only properties according to MSDN. (Horizontal and Vertical size, extent, starting position)

Any ideas on how else I could modify the page size?


You can try setting the values on the Item property e.g

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号