cyanfish / naps2

Scan documents to PDF and more, as simply as possible.
https://www.naps2.com
Other
2.58k stars 315 forks source link

In windows 7 32-bit and 64-bit systems, scanner information cannot be found #368

Open happycoderNo1 opened 2 months ago

happycoderNo1 commented 2 months ago

Hello, I have developed a winform program using NAPS2 SDK and try to invoke scanner using twain. It can work normally in windows10 and 11, but it can not work normally in Windows 7 64 and 32 bit environment. The specific performance is that it takes too long to obtain scanner list and no data is returned. The detailed code is as follows. Could you please give me some help?

ScanningContext scanningContext = new ScanningContext(new GdiImageContext());
var controller = new ScanController(scanningContext);

scanningContext.SetUpWin32Worker();

// Program blocking
List<ScanDevice> scanDevices = await scanController.GetDeviceList(Driver.Twain);
cyanfish commented 2 months ago

I should document this somewhere but I'm not going to officially support Windows 7 with the SDK. The problem is that the worker is built with net8 which doesn't support Win7.

cyanfish commented 2 months ago

If you want you can build your own worker as mentioned here: https://github.com/cyanfish/naps2/blob/798fcaa1008b768dfd86a3a7b8ad8de131cf871a/NAPS2.Sdk.Samples/TwainSample.cs#L10-L17