locked
ImageScanner/ScanRuntimeAPI sample

    Question

  • I am trying to run the ScanRuntimeAPI sample. The sample runs fine with the default scanner settings (format: bitmap, colormode: grayscale). When I try to change any setting (either AutoConfiguration.Format or FlatbedConfiguration.Format), it throws an exception. I have tried this with two different scanners with the same result.

    ImageScanner myScanner = await ImageScanner.FromIdAsync(deviceId);
    if (ModelDataContext.ScenarioRunning)
    {
     if (myScanner.IsScanSourceSupported(ImageScannerScanSource.Flatbed))
     {
      myScanner.AutoConfiguration.Format = ImageScannerFormat.Jpeg; // this throws "Unspecified error" exception
      myScanner.FlatbedConfiguration.Format = ImageScannerFormat.Jpeg; // this throws "The parameter is incorrect." exception

    What am I doing wrong?

    Thanks

    Asim

     

    Monday, March 17, 2014 2:27 PM

Answers

  • If the IsFormatSupported returns false then you cannot set that format: it isn't supported. You'll need to use a format the scanner supports. You can convert to jog afterwards.
    Monday, March 17, 2014 5:23 PM
    Owner

All replies

  • You choose the scan source in the first argument to ImageScanner.ScanFilesToFolderAsync 

    AutoConfiguration.Format takes an ImageScannerAutoConfiguration object, not an ImageScannerFormat object.

    FlatbedConfiguration takes an ImageScannerFlatbedConfiguration object, not an ImageScannerFormat object.

    Monday, March 17, 2014 3:00 PM
    Owner
  • I'm sorry but I do not understand. I'm trying to set FlatbedConfiguration.Format property which is of type ImageScannerFormat. Forthermore, the following line works fine (ImageScannerFormat.DeviceIndependentBitmap is the default value)

    myScanner.FlatbedConfiguration.Format = ImageScannerFormat.DeviceIndependentBitmap;

    but

    myScanner.FlatbedConfiguration.Format = ImageScannerFormat.Jpeg;

    throws "The parameter is incorrect" exception. Also, the following method always return false:

    myScanner.FlatbedConfiguration.IsFormatSupported(ImageScannerFormat.Jpeg)

    This almost seem like a permission issue that I do not have the ability to change scanner's configuration.

    Thanks

    Monday, March 17, 2014 4:35 PM
  • If the IsFormatSupported returns false then you cannot set that format: it isn't supported. You'll need to use a format the scanner supports. You can convert to jog afterwards.
    Monday, March 17, 2014 5:23 PM
    Owner