Page 1 of 1

Question to solve exception "Capability is not supported"

Posted: Mon Aug 26, 2013 7:13 pm
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

Re: Question to solve exception "Capability is not supported

Posted: Wed Aug 28, 2013 9:33 am
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

Re: Question to solve exception "Capability is not supported

Posted: Wed Aug 28, 2013 11:30 am
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