Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Image is not captured if (_bitmapInfo.XPelsPerMeter == 0 || _bitmapInfo.YPelsPerMeter == 0) #13

Open
throwaway1290304032 opened this issue Jan 23, 2014 · 1 comment

Comments

@throwaway1290304032
Copy link

Hi,

In one of my scanning devices, I was getting no image transferred when I sent the scan request through TwainDotNet, even though the device itself did the scanning.

After some guesswork I found the offending line:

bitmap.SetResolution(PpmToDpi(_bitmapInfo.XPelsPerMeter), PpmToDpi(_bitmapInfo.YPelsPerMeter));

It looks like my scanning device is setting _bitmapInfo.XPelsPerMeter = 0 and _bitmapInfo.YPelsPerMeter == 0, so the call to SetResolution fails with 'Invalid Parameter'.

Fixing it is trivial by skipping the call or setting some sensible default if those fields are set to zero.

Thanks, throwaway1290304032

@tmyroadctfig
Copy link
Owner

Could you please issue a pull request with your fix?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants