Support Center

Using DTI.ImageMan.Twain.Array

Tristan Addie Dec 13, 2011 06:54PM EST

Hi I am currently evaluating Imageman.Net, in fact building a scanning interface to drive a Inotec document scanner for my company, but I'm having a little trouble with using the SupportedCaps as I would like to save the current scanner configuration to a XML file.

I'm not sure on how to use DTI.ImageMan.Twain.Array type from when I return this from the DTI.Imageman.Twain.Capabilities object, I just can't get my head around how to get the values out, I understand how setting and getting capabilities work.

3 Data Techniques Responses and 2 Community Responses

Up 1 Rated Down
DTI Support  Data Techniques Employee Dec 13, 2011 09:16PM EST

Hi,

Are you using C# or VB.Net ?

Let me know and I'll get you some sample code.

Thanks,
Sean

Up 5 Rated Down
Tristan Addie  Data Techniques Employee Dec 13, 2011 09:26PM EST

Hi Sean,

Using C#, I was reading you can use this like an enum but I'm still lost I thought about trying to convert it to a system array, and even trying through reflection I could get the count of the items just not at the items.

Up 4 Rated Down
DTI Support  Data Techniques Employee Dec 14, 2011 10:31AM EST

Hi Tristan,

Here's some sample code that will unpack the returned array items:


bool retval = twainControl1.GetCapability(Capabilities.SupportedCaps, out obj, out type);

if (retval)
{
switch (type)
{
case DataType.Array:
DTI.ImageMan.Twain.Array ary = (DTI.ImageMan.Twain.Array)obj;

for (int i = 0; i < ary.Count; i++)
foreach (Object o in ary.Items)
Console.WriteLine(o);


Console.WriteLine("Got an Array");
break;

default:
Console.WriteLine("Got a " + type.ToString());
break;
}
}

Note that the DTI.ImageMan.Twain.Array itself contains a System.Array (.Items) which contains the actual data items. Hopefully this makes sense, let me know if you have any other questions.

Thanks for your interest in our products and please let us know if you have any questions.

Sincerely,
Sean
Data Techniques Support

Up 1 Rated Down
Tristan Addie  Data Techniques Employee Dec 15, 2011 07:14AM EST

Sean,

That worked a treat I can see the capabilties :), thankyou for your help.

Tristan

Up 3 Rated Down
DTI Support  Data Techniques Employee Dec 15, 2011 10:20AM EST

Hi Tristan,

You're welcome, pls let us know if you have any other questions.

Sean
Data Techniques, Inc.

This question is closed to new answers.

Contact Us