NAPS2.WebScan contains sample code for scanning from a web browser in JavaScript/TypeScript using NAPS2.Sdk.
Consider a corporate network with an intranet site we want to add scanning capabilities to. Users will scan using a scanner attached to their local machine and then upload it to the intranet server.
NAPS2.WebScan.LocalService
is a Windows Service we would install on every client machine. It shares scanning devices attached to the local machine using ESCL, which is a standard HTTP protocol the browser can connect to.NAPS2.WebScan.WebServer
is an example web server with JS/TS client code for scanning (in practice you would integrate the code with your existing server).
Note that while the sample service code is designed for Windows, the concept can easily be extended cross-platform.
cd NAPS2.WebScan.WebServer
npm install
vite build
- Worker.cs - Setting up the scanner-sharing server
- site.ts - Scanning from JavaScript/TypeScript
- escl-sdk-ts - Lightly modified version of the escl-sdk-ts package used for the client
Have a look at IScanSettingParams and the whole types folder for the type definitions. The ESCL spec may also be helpful.
Keep calling NextDocument
until it errors with a 404.
Feel free to create an issue.