Home › Forums › TWAIN Classic › How to dynamically determine scanned paper size › Reply To: How to dynamically determine scanned paper size
yeah , I have yet to see any unique .net code – everybody starts with NetMaster’s code from codeproject. In the background, outside of your current questions there are a couple 2 or 3 problems that everyone using his code usually has to overcome. his twCapability contrutors hard code an address size that should be based on the type of the capability you’re contructing. His code didn’t track the twState, this is invaluable – declare a member variable for track in the twState. Also, check/track the ConditionCode when twRc != success.
Back to your questions,
ImageLayout has never been usful for me. I’m not saying that it is worthless, just that I have yet to find a use for it.
the critical part of your code is your ImageNativeXfer Get call.
rc = DSixfer(appid, srcds, TwDG.Image, TwDAT.ImageNativeXfer, TwMSG.Get, ref hbitmap);
if you call ImageInfo get before that call you *should* be in twState 6 and the info is estimated, if you call ImageInfo.Get just afterward (and rc== success) you should be in twState7 and the call shoulsd produce the actual values.
Your other question:
Is there a setting that would cause the scanner to pull in the paper when I call rc = DSiinf(appid, srcds, TwDG.Image, TwDAT.ImageInfo, TwMSG.Get, iinf); and rc = DSiinf(appid, srcds, TwDG.Image, TwDAT.ImageInfo, TwMSG.Get, iinf); ?
no. ImageInfo.Get is not documented as causing the paper to feed and there is not setting that turns that on or off – if it is the case with the device you’re using it is just something that vendor decieded to do.
.