This topic contains 6 replies, has 4 voices, and was last updated by Damoms 4 months ago.
June 12, 2013 at 7:13 am #22855
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)
// 1 inch from the top and 0 from the left
layout.FrameNumber = 1;
layout.PageNumber = 1;
layout.DocumentNumber = 1;
rc = DSilayout(appid, srcds, TwDG.Image, TwDAT.ImageLayout, TwMSG.Set,layout);
if (rc != TwRC.Success)
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.
subhajitJune 13, 2013 at 7:37 am #25914
knock knock, anybody plzz help me, I am just stuck………..June 17, 2013 at 10:04 am #25915
With your settings below, you should get 3 inch from the top and 6 inch from the left.
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]
private void btnSetAndAcquire_Click(object sender, System.EventArgs e)
float fFrameLeft, fFrameTop, fFrameRight, fFrameBottom;
fFrameLeft = Convert.ToSingle(edtFrameLeft.Text);
fFrameTop = Convert.ToSingle(edtFrameTop.Text);
fFrameRight = Convert.ToSingle(edtFrameRight.Text);
fFrameBottom = Convert.ToSingle(edtFrameBottom.Text);
MessageBox.Show("Please input numerical values in the input boxes.", "Error");
dynamicDotNetTwain.OpenSource(); //make dynamicDotNetTwain ready for capability negotiation
if (dynamicDotNetTwain.SetImageLayout(fFrameLeft,fFrameTop,fFrameRight,fFrameBottom) == false)
dynamicDotNetTwain.IfShowUI = false;
dynamicDotNetTwain.IfDisableSourceAfterAcquire = true;
Hope it helps.June 17, 2013 at 1:06 pm #25916
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
Yes. Try update your code below as follows and see how it works.
layout.FrameNumber = -1;
layout.PageNumber = -1;
layout.DocumentNumber = -1;
www.dynamsoft.comJune 25, 2013 at 9:08 pm #25918
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.
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
Thank you very much for your reply, but can it be possible with simply using TWAIN32.dll?