TWAIN Working Group

Quarterly Newsletter Signup       
  • Home
  • About
    • What’s New?
    • Specification & Tools
    • Self Certification Process
    • TWAIN Features
    • TWAIN Direct
    • Membership
    • News
    • Events
    • Logo Usage
    • TWAIN License
    • Contact Us
  • Scanner User
    • Find Drivers
  • Driver Developer
  • Application Developer
  • Scanner Service Provider
  • TWAIN Forums
  • Resources
    • Find Certified Drivers

Flatbed scanning region

Forums › TWAIN Classic › Flatbed scanning region

This topic contains 6 replies, has 3 voices, and was last updated by  Damoms 1 year, 1 month ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • June 12, 2013 at 7:13 am #22855 Reply

    subhajit
    Participant
    • Topics - 1
    • Replies - 2
    • Total Posts - 3

    hi all,

    Please help me out. My scanner is a flatbed canon scanner (canon 5600f) with twain compatible and my application is based on C#.net 3.5.
    I just want to tell the scanner to scan a specific region, that means, that light bar(sensor) will travel a specific region. I found some solution in the net, but unfortunately those are not working. The sensor travel allover the region. Below is my code,
    TwainImageLayout layout = new TwainImageLayout();
    rc = DSilayout(appid, srcds, TwDG.Image, TwDAT.ImageLayout, TwMSG.Get, layout);
    if (rc != TwRC.Success)
    {
    CloseSrc();
    return false;
    }

    // 1 inch from the top and 0 from the left
    layout.Frame.Top.FromFloat(0);

    layout.Frame.Left.FromFloat(0);

    layout.Frame.Right.FromFloat(6);

    layout.Frame.Bottom.FromFloat(3);

    layout.FrameNumber = 1;
    layout.PageNumber = 1;
    layout.DocumentNumber = 1;

    rc = DSilayout(appid, srcds, TwDG.Image, TwDAT.ImageLayout, TwMSG.Set,layout);
    if (rc != TwRC.Success)
    {
    CloseSrc();
    return false;
    }

    Is it a right way to do that? what are the values, I should provide for Top, Left, Right, Bottom (These values are really confused me!!!!).

    Please help me out.

    Thanks,
    subhajit

    June 13, 2013 at 7:37 am #25914 Reply

    subhajit
    Participant
    • Topics - 1
    • Replies - 2
    • Total Posts - 3

    knock knock, anybody plzz help me, I am just stuck………..

    June 17, 2013 at 10:04 am #25915 Reply

    Catherine Sea
    Participant
    • Topics - 0
    • Replies - 59
    • Total Posts - 59

    With your settings below, you should get 3 inch from the top and 6 inch from the left.

    layout.Frame.Top.FromFloat(0);
    layout.Frame.Left.FromFloat(0);
    layout.Frame.Right.FromFloat(6);
    layout.Frame.Bottom.FromFloat(3);

    You may check out a working demo using Dynamic .NET TWAIN.

    When I set (0,0,8,8), we will get the image like this:
    [attachment=0:1k7cjwrl]SetImageLayout – Dynamic .net twain.png[/attachment:1k7cjwrl]

    Related code:

    private void btnSetAndAcquire_Click(object sender, System.EventArgs e)
    {
    float fFrameLeft, fFrameTop, fFrameRight, fFrameBottom;

    try
    {
    fFrameLeft = Convert.ToSingle(edtFrameLeft.Text);
    fFrameTop = Convert.ToSingle(edtFrameTop.Text);
    fFrameRight = Convert.ToSingle(edtFrameRight.Text);
    fFrameBottom = Convert.ToSingle(edtFrameBottom.Text);
    }
    catch (Exception)
    {
    MessageBox.Show("Please input numerical values in the input boxes.", "Error");
    return;
    }

    dynamicDotNetTwain.SelectSource();
    dynamicDotNetTwain.OpenSource(); //make dynamicDotNetTwain ready for capability negotiation

    if (dynamicDotNetTwain.SetImageLayout(fFrameLeft,fFrameTop,fFrameRight,fFrameBottom) == false)
    MessageBox.Show(dynamicDotNetTwain.ErrorString, "Error");

    dynamicDotNetTwain.IfShowUI = false;
    dynamicDotNetTwain.IfDisableSourceAfterAcquire = true;
    dynamicDotNetTwain.EnableSource();

    }

    Hope it helps.

    June 17, 2013 at 1:06 pm #25916 Reply

    subhajit
    Participant
    • Topics - 1
    • Replies - 2
    • Total Posts - 3

    Thank you very much for your reply, but can it be possible with simply using TWAIN32.dll? Because the library u have mentioned, is pretty expensive!

    Please help.

    June 19, 2013 at 8:32 am #25917 Reply

    Catherine Sea
    Participant
    • Topics - 0
    • Replies - 59
    • Total Posts - 59

    Yes. Try update your code below as follows and see how it works.

    layout.FrameNumber = -1;
    layout.PageNumber = -1;
    layout.DocumentNumber = -1;

    Catherine Sea
    www.dynamsoft.com

    June 25, 2013 at 9:08 pm #25918 Reply

    spike
    Participant
    • Topics - 10
    • Replies - 139
    • Total Posts - 149

    Hi subhajit – is the TWAIN device in the Open state when you start that code?

    and after that code, you start a scan by doing something like Enable or EnableSource?
    (I don’t know this particular library you are using).

    Both your DSilayout calls return TWRC_SUCCESS?

    Are you setting any other scanning parameters?
    I hope if you are setting ICAP_UNITS at all, it is to TWUN_INCHES 😉

    You could download and try something like my Twirl app, to see how your Canon responds to ImageLayout.
    http://eztwain.com/twirl.htm
    At least then you could have the confidence that the commands *should* work, and you can concentrate on digging into the code to see where things go awry.

    January 17, 2018 at 12:23 am #30802 Reply

    Damoms
    • Topics - 0
    • Replies - 0
    • Total Posts - 0

    Thank you very much for your reply, but can it be possible with simply using TWAIN32.dll?

    บาคาร่า

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Flatbed scanning region
Your information:




Quick Links

TWAIN Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

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

Recent Topics

  • TwainDSM is crashing
  • TWAIN_SetCurrentResolution(100)
  • How to detect camera capture button without blocking video going to another app
  • Can I save the scanned image as a PDF?
  • Does TwainDSM.DLL Replace Twain_32.dll
  • Contact Us
Privacy Policy • Copyright © 2019 TWAIN Working Group • by iHwy, Inc.

Log in

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.