Open CapacitorDev opened 1 year ago
I am not sure I know what "paper ejection" means, but it does not sound like a standard TWAIN capability.
1) What is the name of the device?
2) If it is a custom TWAIN capabilty, you will need to know which one it is and set it using DTWAIN_SetCapValues. For this, it requires that you know from the manufacturer if custom capabilties are supported, and which one it is.
hi @dynarithmic , thank you for the reply.
"paper ejection" --> when you open with UI, you will see this setting.
I want the code let the paper forward out of the scanner after scanning. ( not return backward the paper, it occurs Paper Jam a lot this way )
If you run the DTWDEMO.exe program that is in the demo .zip file, you can select the source, and get a listing of the capabilities if you choose Source Properties... from the main menu Source Selection Test.
If you see capabilities named CAP_CUSTOMBASE + xxxx, those are the custom capabilities.
I found 6 custombase but I can not retrieve the value of them using DTWAIN_GetCapValues
Here is the C# code, only CAP_CUSTOMBASE + 100 supported to getcapvalues. ` DTWAIN_ARRAY defa = IntPtr.Zero;
int[] com = { 0x8064 , 0x806E , 0x806f , 0x8072, 0x8073, 0x8074 };
for (int i = 0; i < 6; i++)
{
int isCapSup = TwainAPI.DTWAIN_IsCapSupported(SelectedSource, com[i]);
Console.WriteLine("Supported?? " + com[i] + " : ---> " + isCapSup);
int ok = TwainAPI.DTWAIN_GetCapValues(SelectedSource, com[i], TwainAPI.DTWAIN_CAPGET, ref defa);
Console.WriteLine("Get value ok?? " + com[i] + " -----> " + ok);
if(ok == 1)
{
long count = TwainAPI.DTWAIN_ArrayGetCount(defa);
double vl = 0;
for (int j = 0; j < count; j++)
{
TwainAPI.DTWAIN_ArrayGetAtFloat(defa, j, ref vl);
Console.WriteLine("Value " + vl);
}
}
}`
Supported?? 32868 : ---> 1 Get value ok?? 32868 -----> 1 Value 1.61900371485718E-319 Supported?? 32878 : ---> 1 Get value ok?? 32878 -----> 0 Supported?? 32879 : ---> 1 Get value ok?? 32879 -----> 0 Supported?? 32882 : ---> 1 Get value ok?? 32882 -----> 0 Supported?? 32883 : ---> 1 Get value ok?? 32883 -----> 0 Supported?? 32884 : ---> 1 Get value ok?? 32884 -----> 0
DTWAIN does not know what those capabilities do, what data type they are (string, booleans, integers, etc.), and whether they can be set (some may be read-only).
You will need to get the custom capability information from the manufacturer (Plustek) as to the data type, container used to store the information, etc. I do not know where to get this information, probably from whoever creates the Plustek drivers.
Once you get this information, you would call DTWAIN_GetCapValuesEx() specifying the container to use and data type.
The information you get should be similar to what you will find in the Twain specification manual in Chapter 10-3. You see the capabiltiy, container used, data type, etc. This is the information you need from Plustek. All DTWAIN can do is allow you to retrieve the values, but you must know how to set up the retrieval of the values.
You could try a different data type instead of float to see if any of the ones that return "success" give any correct values.
See DTWAIN_GetCapValuesEx2. This gives you detailed information on how to properly get the cap values, once you get the information about the capability.
Hi, my scan has two ejection forward and backward.
any one know how to set up it by using code C#?
thank you!