Question to solve exception "Capability is not supported"

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
mierli
Posts: 6
Joined: Tue Aug 13, 2013 8:09 am

Question to solve exception "Capability is not supported"

Post by mierli »

Hello
I have a problem to work with the property "device.PageSize".
For one scanner the property works fine, and I can set the PageSize to "PageSize.A4" - the scanner is the Canon Lide 500f.

On an other scanner I get an exception during the runtime or debug - "Capability is not supported - Name= ISupportedSizes".
This is a HP Office-Jet Pro 8500.

How I could check this property whether the the "PageSize" is valid for one scanner or not valid for other scanners; so I could solved this problem - but I don't know, how I could check for valid/or not valid.

Please have you a clue for my problem?
Many thanks in advance & best regards
Michael
Alex
Site Admin
Posts: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: Question to solve exception "Capability is not supported

Post by Alex »

Hello Michael,

You need check supported page sizes using the Device.GetSupportedPageSizes method before setting value of the PageSize property.

Best regards, Alexander
mierli
Posts: 6
Joined: Tue Aug 13, 2013 8:09 am

Re: Question to solve exception "Capability is not supported

Post by mierli »

Hello Alex
thanks for your reply.

If I call this method "Device.GetSupportedPageSize()", I get also an exception. So now I add a workaround to check in a try/catch-block with the "GetSupportedPageSize()"-method the pageSize-property.

Code: Select all

   ....
   .....
               bool pageSizeIsSupported = true;
                try
                {
                    var x = _device.GetSupportedPageSizes();
                }
                catch (TwainDeviceCapabilityException)
                {
                    pageSizeIsSupported = false;
                }
   .....
   .....
   ...
And after this try/catch-block, I set my properties or don't set the pageSize-property.

Best regards, Michael
Post Reply