.net - Can I configure settings in UWP app desktop scanner? -


i have had success in getting input flatbed scanner in uwp app

using windows.devices.enumeration; using windows.devices.scanners;  imagescanner myscanner = await imagescanner.fromidasync(deviceid); var result = await myscanner.scanfilestofolderasync(imagescannerscansource.default, folder); 

and make use of auto configured scan profile

if (myscanner.isscansourcesupported(imagescannerscansource.autoconfigured)) {     ...     // scan api call start scanning auto-configured settings.      var result = await myscanner.scanfilestofolderasync(         imagescannerscansource.autoconfigured, folder).astask(cancellationtoken.token, progress);     ... } 

but there way can control configuration, lower resolution or b&w? of format options appear read properties. have tried make external scanner profile in win10 isn't picked (even when default). api appears aware of scanner supported settings because scantostream equivalent call reads in lowest possible resolution preview.

is there way can control configuration, lower resolution or b&w

sure, please check imagescanner.flatbedconfiguration property

the imagescannerflatbedconfiguration class includes several writable properties, example: desiredresolution , colormode

a sample set scan file format png , adjust desired resolution:

if (scanner.isscansourcesupported(imagescannerscansource.flatbed)) {  // set scan file format png, if available     if (scanner.flatbedconfiguration != null)     {         if (scanner.flatbedconfiguration.isformatsupported(imagescannerformat.png))         {             scanner.flatbedconfiguration.format = imagescannerformat.png;         }          scanner.flatbedconfiguration.desiredresolution = new imagescannerresolution { dpix = 200, dpiy = 200 };     }      this._cancellationtoken = new cancellationtokensource();      var scantask = scanner.scanfilestofolderasync(imagescannerscansource.flatbed, windows.storage.applicationdata.current.localfolder);     scantask.progress = (info, progressinfo) => debug.writeline("page {0}", progressinfo);      var scanresults = await scantask.astask(this._cancellationtoken.token); } 

reference: [winrt] how scan documents


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -