MBS TWAIN question

Hello,
I am using the MBS TWAIN plugin and it works very well so far. I stumbled upon a problem I can not solve. It can be reproduced when using the „Twain.rbp“ example project which comes with the plugin. When pushing then „Aquire without GUI“-button and there is no paper in the feeder of the scanner then a messagedialog appears. The messagedialog tells me, that there is no paper in the feeder and I can click „OK“ to retry or „Cancel“ to close the messagedialog. When I click the „Cancel“-button and the messagedialog closes, then it is not longer possible to scan images. The „Aquire without GUI“-button does nothing after that. What should I do to make scanning possible, even if there was no paper in the feeder and the user closed the messagedialog by clicking the cancel/abort button?

Thanks in advance,
Christian

Ok,
it seems that the datasource is still opened after clicking the “Cancel”-button in the messagedialog. After closing the the messagedialog with the “Cancel”-button then I get t.Conditioncode = 5. So if I check the conditioncode before calling t.Aquire and t.Conditioncode = 5 I can disable and close the datasource in advance. After disabling and closing the datasource t.Aquire woks correctly and scanning is possible again. Is this the correct solution to this problem?

Well, it sounds right.
You probably just confused the data source.

On the long run, please move to ImageCapture on Mac and WIA on Windows.
TWAIN is 32-bit only in most cases.

Hello Christian,
thanks for your replies.
For document scanning applications TWAIN is the most used / recommended solution. I think I read somewhere, that you also will support TWAIN 64-Bit in the future.

MBS Plugin can do 64-bit TWAIN, but you may not find drivers in 64-bit!

Ok, I understand. The scanners I tested at my university come with TWAIN compatible drivers so for the moment TWAIN is currently the best solution for what we have. But I will also take a look at WIA and ImageCapture for the future.

take a look at the sanescanner app from Axel. for mac or linux only.
https://forum.xojo.com/26909-old-scanner

Hello Jean-Yves,
thanks for your suggestion. I already did some experiments with SANE. While with SANE somehow I was able to use the scanners I tested, some features simply did not work. For example duplex scanning and auto-feed did not work at all with our scanners. It even happened that the whole Mac freezed when using SANE and a reboot was needed.
On the other hand the TWAIN MBS plugin works very well with our scanners. Currently only Windows and Mac support is needed for our scanning solution.

Well we offer a lot of properties but using them may set error properly and the error often is “Function not implemented” as a lot of drivers skip some features.

Hello,
I stumbled upon a new question. From some scanners I only get a portion of the A4 page I try to scan. When using TwainImageInfoMBS and checking the width and length of the transfered image then it shows that the images with and length are too small (for example 850 x 1167 pixels instead of 2480 x 3508 pixels).
How do I tell the scanner, that it should scan an area of 2480 x 3508 pixels? I see that TwainImageLayotMBS has Left, Right, Top and Bottom properties which maybe could be the solution. But I seem to not understand how to use this. If we take for examle the „Twain.rbp“ example project, how would I tell there the scanner to scan an area of 2480 x 3508 pixels?

Addition to my last question: The bespoke scanners deliver (when using the „Twain.rbp“ example) the whole scanned page when calling Aquire(FALSE, TRUE) which means that the scanners dialog is shown before the scan starts, but only a portion or the scanned page when calling Aquire(FALSE, FALSE) which means that no dialog is shown before the scan starts.

Do the scanners do some auto detection and maybe remove borders?

Hello,
I have:

t.AutomaticRotate = 1
t.FeederEnabled = 1
t.AutoFeed = 1
t.AutomaticBorderDetection = 1
t.DiscardBlankPages = 1
t.Duplex = 1
t.Orientation = 0
t.PixelType = 0
t.ResX = 300.0
t.ResY = 300.0

Edit: But when I use the „Twain.rbp“ example (where nothing is set) I get the same result. For the moment I cant not conitnue testing because I have no access to the scanners until next week.

t.AutomaticBorderDetection maybe?

Hello Christian,
thanks for your reply. I think I changed that setting already without effect but I can try again next week.

Ok, so I tested
t.AutomaticBorderDetection = 0
and also
t.AutomaticBorderDetection = -1
but no success.
Also I played around with the other settings (setting them to 0) but that did not help either.
Most scanners do scan the whole page correctly, but some scanners do only scan a part of the page:
Scanner model 1 only scans the top left corner, scanner model 2 scans maybe 80% of the page (the 20% from the bottom are missing).
So: Is there a way to tell these scanners to scan a larger area?

Hello,
I am still stuck with the question how to use TwainImageLayoutMBS. I tried the code below before calling Aquire but it does nothing, regardless which scanner I use. Is there an example how to use TwainImageLayoutMBS to tell the scanner the area it should scan?

t.OpenDS
dim n as TwainImageLayoutMBS = t.Imagelayout
n.Left = 0
n.Top = 0
n.Bottom = 200
n.Right = 300

call t.Acquire(FALSE, FALSE)

you query image layout, you get a copy of the layout and than modify the copy just before throwing it away?

Maybe you miss a line:

t.TwainImageLayoutMBS = n

to pass it back.