Call the scanner presetting profiles

Issue #9 new
Kenny Hsu created an issue

My scanner software can store some presettings and use it by selecting one of them from the dropdown list. I am planning to call this function in my C# program without using their scanning software. The manufacturer gave me two info as following: 1. use TWAIN as follows

     How to Get/Set Preset Setting: (SWDI)
Please include the following definitions in your header file.
----------------------------------------------------------------------------------------------------------------------------
#define MIDAT_CAPABILITY                                                                        (0x8001)
#define MIICAP_PRESETTING                                                                        (0x83F4)
----------------------------------------------------------------------------------------------------------------------------
Please use the DG_CONTROL/MIDAT_CAPABILITY/ MIICAP_PRESETTING capability.
1.        MSG_GET message to get the name list of the preset setting, the return type is TWON_ARRAY, and item type is TWTY_STR64.
2.        MSG_GETCURRENT message to get current preset setting name, the return type is TWON_ONEVALUE, and item type is TWTY_STR64.
3.    MSG_SET message to inform TWAIN driver to use which preset setting by it’s name. Please use TWON_ONEVALUE to set, and item type is TWTY_STR64. 

and 2. this link: https://bitbucket.org/soukoku/ntwain.

I didn't find any "loading presetting" ability in the CapabilityId enum. Are you familiar with this? May I request a sample of this function in your test.Winform project?

Comments (6)

  1. Eugene Wang repo owner

    Actually I was wrong :P

    It's also a new DAT value so the lib will need some update to support it.

  2. Eugene Wang repo owner

    I updated the source for custom DAT with capability methods.

    You should be able to use them like this

    twainSession.DGControl.CapabilityCustom.Get(MIDAT_CAPABILITY, ...);
    twainSession.DGControl.CapabilityCustom.GetCurrent(MIDAT_CAPABILITY, ...);
    twainSession.DGControl.CapabilityCustom.Set(MIDAT_CAPABILITY, ...);
    

    Look at the TwainSessionExtensions.cs code file for examples on how to create and parse TWCapability objects. GetCapabilityValues and GetCurrentCap are the 2 related get example. Just cast MIICAP_PRESETTING into CapabilityId to create the cap object.

    using (TWCapability cap = new TWCapability((CapabilityId)MIICAP_PRESETTING))
    
  3. Log in to comment