LEADTOOLS Support
Imaging
Imaging SDK Questions
Force feeder acquiring with v15 API with Delphi
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, March 20, 2008 4:18:27 AM(UTC)
Groups: Registered
Posts: 7
Hello.
I using Lead Tools v15 API with Delphi.
I want to drive a scanner to capture many documents setting three parameters from my application:
1 - Resolution 300x300
2 - Bit per pixel 1
3 - Force acquiring from feeder
I tried to do that with this code:
X.Whole := 300;
Y.Whole := 300;
L_TwainSetResolution(hSession, @X, @Y);
L_TwainSetImageBitsPerPixel(hSession, 1);
This code works correctly, but there is not a function that allows me to force the acquisition from feeder (I did not found it).
First question: there is a *L_TwainSetPaperSource* function to add at the previous code?
Then I tried to use the following code, which should make it possible to set all the three parameters:
ZeroMemory(@Params, sizeof(LTWAINPROPERTIES));
L_TwainStartCapsNeg(hSession);
L_TwainGetProperties(hSession, @Params, sizeof(LTWAINPROPERTIES), LTWAIN_PROPERTIES_GETCURRENT);
L_TwainEndCapsNeg(hSession);
Params.ImageRes.nBitsPerPixel := 1;
Params.ImageRes.fHorzResolution := 300;
Params.ImageRes.fVertResolution := 300;
Params.bPaperSource := True;
L_TwainStartCapsNeg(hSession);
L_TwainSetProperties(hSession, @Params, LTWAIN_PROPERTIES_SET, nil, nil);
L_TwainEndCapsNeg(hSession);
The result of using this code is that I can set only the resolution, while the other parameters remain not set.
Second question: what is my mistake?
Third question: there another way to set these three parameters at run time?
Regards
Franco
#2
Posted
:
Sunday, March 23, 2008 2:56:06 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Please try
to use the L_TwainSetCapability and set the "CAP_FEEDERENABLED"
capability to TRUE, does this fix your issue?
#3
Posted
:
Wednesday, March 26, 2008 9:55:24 PM(UTC)
Groups: Registered
Posts: 7
I have tested what you suggested, also copying something from the examples that there are in documentation.
It seems to work fine.
I have set resolution and bits per pixel with the specific functions and the feeder with
L_TwainSetCapability.
Here is the code I made (for who develops with Delphi):
var
nRet: L_INT;
X, Y: TW_FIX32;
twCap: TW_CAPABILITY;
pOneVal: pTW_ONEVALUE;
begin
L_TwainStartCapsNeg(hTwnSession);
// set resolution
X.Whole := 300;
Y.Whole := 300;
L_TwainSetResolution(hTwnSession, @X, @Y);
// set bits per pixel
L_TwainSetImageBitsPerPixel(hTwnSession, 1);
// force feeder
twCap.Cap:= CAP_FEEDERENABLED;
twCap.ConType:= TWON_ONEVALUE;
twCap.hContainer:= GlobalAlloc(GHND, sizeof(TW_ONEVALUE));
pOneVal:= pTW_ONEVALUE(GlobalLock(twCap.hContainer));
pOneVal.Item:= TW_UINT32(True);
pOneVal.ItemType:= TWTY_BOOL;
GlobalUnlock(twCap.hContainer);
L_TwainSetCapability(hTwnSession, @twCap, LTWAIN_CAPABILITY_SET);
L_TwainEndCapsNeg(hTwnSession);
end;
Franco
LEADTOOLS Support
Imaging
Imaging SDK Questions
Force feeder acquiring with v15 API with Delphi
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.