Forum Replies Created
August 17, 2016 at 5:30 pm in reply to: Weird behaviour using different TWAIN DSM Versions. #26386
DAT_IMAGEINFO must be called in state 7 after TWRC_XFERDONE is returned by one of the DAT_IMAGE*XFER calls. Anything prior to that is not required to return complete or correct information.
TWAIN is forward and backwards compatible, there are some changes that occur with the versions (especially going from 1.9 to 2.0), but in most cases these can be ignore on the application side. The TWAIN Spec tries to call all of these out in one chapter.
That system may well be proprietary to the scanner vendor, in which case you have to contact them for more info. Or you can see I they support the TWAON standard DAT_CUSTOMDSDATA operations…August 17, 2016 at 5:19 pm in reply to: Could not see TWain Component on Component Palette #26348
I did a little hunting and found this site:
And there is this comment:
TDelphiTwain 1.4 is not a TComponent descendand any more – you can’t install it into the Delphi pallete and use it as a non-visual component any more. You have to use it from code only and free it by yourself (see the DEMO).
I don’t use it, so I’m afraid that’s as far as I can go…
You need to contact your scanner vendor for help with this kind of problem. The TWAIN Working Group handle the Specification and the Data Source Manager, but the actually TWAIN drivers are written and maintained by each scanner vendor.
TWAIN drivers tend to be more feature rich and come with more image processing parameters than SANE drivers, even for exactly the same scanner model, so this isn’t too much of a surprise. You should be able to examine the TWAIN capabilities, either through the user interface or programmatically, to see if the TWAIN driver offers a way to get an image that has less processing…
There are two kinds of rotation in TWAIN: ICAP_ORIENTATION, which defines the which side of a sheet of paper is the leading edge being scanned. And ICAP_ROTATION (and ICAP_AUTOMATICROATE) which causes the scanner to rotate the finished image.
In both cases the scanner vendor has to choose to support these capabilities, so an application cannot assume they’ll always be present for use.
Yes, check the following Kodak Alaris custom capability (found in the kdscust.h file that came with your CD)
// Family: Blaze, Falcon, Panther, Piranha2, Saturn
// Type: TWTY_FIX32
// Container: Range
// Allowed: Scanner specific
// Default: Scanner specific
// Notes: Adjusts the value of ICAP_PHYSICALHEIGHT. Applications must
// set this value to have access to the full scan length of the
#define ICAP_PHYSICALHEIGHTADJUST 0x8101
The TWAIN CS project is a C# interface to TWAIN drivers. It’s a single solution (four projects) that is built usually Visual Studio. I recommend running the scanning application. One you have the sample built and working you can examine the sample application to see how to access the TWAIN CD toolkit.
As for integrating with an existing C# project, you just need the toolkit cs module, and the twain cs and twainh cs modules. I recommend copying them into your project. Then, using the scanning sample as a template, copy over the code needed to initialize the toolkit. You’ll need the scan callback function, which is invoked for the images passing through the system, and that’s about it.
For information about TWAIN Direct please look here: http://twaindirect.org
Work on TWAIN Direct is ongoing, but I don’t expect any updates on its progress until September.
And for help with browser-based scanning, I recommend looking into the following vendors:
There is also a TWAIN C# project that may be helpful, depending on what coding you’re looking to do.
Can you be more specific?
Can you be more specific? I write native 64-bit TWAIN drivers, so I know they work well. Is there a specific scanner you’re having trouble with?
A number of fixes were made and checked on multiple scanner models. It’s very likely this problem has been addressed…
The TWAIN C# project comes with two applications. One is a diagnostic application. The other is a regular scanning application, and is designed to show how one can write a C# application to interface to the TWAIN C# toolkit.
The built-in toolkit attempts to make coding easier by moving the image transfer code into a callback. The application starts scanning, and the callback processes images, metadata and status returns.
As for communication, the toolkit does this using CSV strings. This was done to take away the pain of having C# marshal to C/C++ data structures.
Here is how to turn on duplex scanning. You can find this code similar to this in: TWAIN CS 02.03.02.00twaincssourcetwaincsscansourceFormScan.cs
string szStatus = “”;
string szCapability = “CAP_DUPLEXENABLED,TWON_ONEVALUE,TWTY_BOOL,1”;
TWAINCSToolkit.STS sts = m_twaincstoolkit.Send(“DG_CONTROL”, “DAT_CAPABILITY”, “MSG_SET”, ref szCapability, ref szStatus);
Be sure to confirm that the status is success, in case the scanner doesn’t support duplex.
This is the command sent to start scanning. You can find this code in: TWAIN CS 02.03.02.00twaincssourcetwaincsscansourceFormScan.cs
string szStatus = “”;
string szTwmemref = “0,0,” + this.Handle;
TWAINCSToolkit.STS sts = m_twaincstoolkit.Send(“DG_CONTROL”, “DAT_USERINTERFACE”, “MSG_ENABLEDS”, ref szTwmemref, ref szStatus);
The contents of szTwmemref are a CSV encoded version of the TW_USERINTERFACE structure described in the TWAIN Specification and found in the C/C++ TWAIN.H file.
Note that this CSV scheme can be used with the diagnostic application, so that’s a good tool for experimenting with a driver to see how it all works.
TWAIN Direct hasn’t yet reached ratification by the TWAIN Working Group. A draft version has been published and is being maintained for review and comment.
Unfortunately, it’s too early to discuss the plans of scanner vendors. I believe I can state with good confidence that TWAIN Direct will go live in 2016. At this point I expect it will be sometime in the second half of 2016.
If you have more questions about it, please feel free to ask.
— MarkFebruary 17, 2016 at 5:41 pm in reply to: Twain duplex scanning slow for windows 7 compared to win 8 #26355
Unfortunately, there’s nothing that we can do to help you. You need to contact Canon directly to ask about the performance of their TWAIN driver.