Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, July 20, 2006 11:33:01 PM(UTC)

tberg  
tberg

Groups: Registered
Posts: 1


I am evaluating Imaging/Barcode/PDF Tools EVAL 14.5 for a Delphi VCL project. I would set
all twain parameters into the code (Without a Twain Dialog).
 
If i set the ColorScheme parameter from TWPT_BW to TWPT_GRAY i can see no result. 

- if i change the "HorzResolution" or other settings i can see the results
- if i change from "AcquireMulti" to "Acquire" i can see the change from TWPT_BW to TWPT_GRAY
- if i change the parameter about the twain dialog i can see the correct result


Here is the code...

     LEADTwain1.SelectSource();
     SetFocus();

     FillMemory ( @twProps, sizeof(LTWAINPROPERTIES), 0 );

     nRet:= LEADTwain1.GetProperties ( @twProps, LTWAIN_PROPERTIES_GETCURRENT );

     if ( nRet <> SUCCESS ) then
        begin
        Exit;
        end;

     twProps.DataTransfer.nTransferMode:= TWSX_FILE;
     StrCopy ( twProps.DataTransfer.szFileName, 'd:\temp\Twain.tif' );
     twProps.DataTransfer.nScanFileFormat    := TWFF_TIFFMULTI;
     twProps.DataTransfer.nBufMemCompression := TWCP_NONE;
     twProps.ImageRes.fHorzResolution        := 300;
     twProps.ImageRes.fVertResolution        := 300;
     twProps.ImageEff.nColorScheme           := TWPT_GRAY;
     twProps.nDuplexScanning                 := 2;


     LEADTwain1.EnableSetPropertiesEvent:= True;
     nRet:= LEADTwain1.SetProperties ( @twProps, LTWAIN_PROPERTIES_SET );
     if ( nRet <> SUCCESS ) then
        begin
        Exit;
        end;

    LEADTwain1.EnableAcquireMultiEvent:=True;
    LEADTwain1.EnableAcquirePageEvent:=True;

    nRet:= LEADTwain1.AcquireMulti ( 'd:\temp\test.tif', LTWAIN_SHOW_NONE, LTWAIN_BUFFER_MODE, FILE_TIF, 1, TRUE, 0, TRUE );


Thanks for your help.

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, July 24, 2006 6:17:22 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Hello,

If your scanner driver supports the Image Pixel Type capability, you can use the following code to set its value:
-------------------------------
Var
nRet: L_INT;
twCap: TW_CAPABILITY;
Begin
LEADTwain1.InitSession(Handle);
// Show the Twain Select Source UI
nRet := LEADTwain1.SelectSource();
If(nRet <> SUCCESS) then
Begin
ShowMessage('Error occurred while selecting the source.');
Exit;
End;

twCap.Cap:= ICAP_PIXELTYPE;
twCap.ConType:= TWON_ONEVALUE;

// Set the desired pixel type in the last parameter
LEADTwain1.CreateNumericContainerOneValue (@twCap, TWAINNUMERICTYPE_TW_UINT16, L_TWPT_RGB);

nRet := LEADTwain1.SetCapability(@twCap, LTWAIN_CAPABILITY_SET);
LEADTwain1.FreeContainer(@twCap);
-------------------------------

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.126 seconds.