Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
happycoderNo1 opened this issue Apr 15, 2024 · 2 comments

Comments

@happycoderNo1
Copy link

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
Copy link
Owner

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
Copy link
Owner

If you want you can build your own worker as mentioned here:

// Scanning with TWAIN on Windows must happen from a 32-bit process. You can do this by building your exe as
// 32-bit, but the better solution is to install the NAPS2.Sdk.Worker.Win32 Nuget package, which includes a
// pre-compiled 32-bit NAPS2.Worker.exe. Then you only need to call ScanningContext.SetUpWin32Worker and you
// should be able to scan with TWAIN.
//
// If you want to use a worker process but don't want to use a pre-compiled exe (or want to set up your own
// logging etc), you can also build your own worker exe with the same name (and call WorkerServer.Run in its
// Main method).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants