TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

Reply To: How to dynamically determine scanned paper size

Forums › TWAIN Classic › How to dynamically determine scanned paper size › Reply To: How to dynamically determine scanned paper size

January 14, 2008 at 5:29 pm #24263
MKJO
Participant
  • Topics - 1
  • Replies - 4
  • Total Posts - 5

I have looked through the examples you posted and the OpenTwain project you refer to. I have been using the same logic as you are. I actually got my code from the sample project on http://www.codeproject.com/dotnet/twaindotnet.asp.

This is what I have been running. I apologize for not posting all of it to begin with.

            do
{
pxfr.Count = 0;
hbitmap = IntPtr.Zero;

// Per the examples, here is where I am supposed to capture ImageInfo and ImageLayout ...
// But when this code runs the paper is still laying in the tray unscanned.
iinf = new TwImageInfo();
rc = DSiinf(appid, srcds, TwDG.Image, TwDAT.ImageInfo, TwMSG.Get, iinf);
if (rc != TwRC.Success)
{
CloseSrc();
return pics;
}
ilyt = new TwImageLayout();
rc = DSilayout(appid, srcds, TwDG.Image, TwDAT.ImageLayout, TwMSG.Get, ilyt);
if (rc != TwRC.Success)
{
CloseSrc();
return pics;
}

// Store the returned values into my struct - But the values are always the same
// regardless if the paper is 8.5x11 or 5x6
imf = new ImgInfo();
imf.sizeX = iinf.ImageWidth;
imf.sizeY = iinf.ImageLength;
imf.posLeft = ilyt.Frame.Left.ToFloat();
imf.posRight = ilyt.Frame.Right.ToFloat();
imf.posTop = ilyt.Frame.Top.ToFloat();
PictureInfo.Add(imf);

// Now the paper is fed throught the machine and scanned
rc = DSixfer(appid, srcds, TwDG.Image, TwDAT.ImageNativeXfer, TwMSG.Get, ref hbitmap);
if (rc != TwRC.XferDone)
{
CloseSrc();
return pics;
}
// Right here is where I would expect to be able to get my information because the documents have now been scanned.

rc = DSpxfer(appid, srcds, TwDG.Control, TwDAT.PendingXfers, TwMSG.EndXfer, pxfr);
if (rc != TwRC.Success)
{
CloseSrc();
return pics;
}

pics.Add(hbitmap);
}
while (pxfr.Count != 0);

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); ?

Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • Problem enumerating list of installed scanners in windows server 2012
  • Failed to create TWAIN progress! Error code is 1260.
  • To get the list of scanners from javascript client side (browser)
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in