首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >如何在信创系统上通过Javascript使用TWAIN、SANE协议快速集成扫描仪

如何在信创系统上通过Javascript使用TWAIN、SANE协议快速集成扫描仪

原创
作者头像
用户1935133
修改2025-01-23 11:31:20
修改2025-01-23 11:31:20
6810
举报

如何在信创系统上通过Javascript使用TWAIN、SANE协议快速集成扫描仪

当我们在Linux系统使用WebScanner扫描组件时,第一次进行扫描时需要安装扫描服务组价,一般页面会提示用户需要安装WebScanner扫描服务。

安装提示
安装提示

这时,我们根据提示下载服务安装程序,进行安装,安装后刷新页面就可以进行扫描了。

1 在Linux系统访问WebScanner应用

在Linux系统访问WebScanner应用(官网DEMO演示 或 已集成WebScanner的应用系统)

 提示:

  • 支持常规Ubuntu系列、RedHat/Fedora系列Linux系统;
  • 支持国产统信Linux系统、银河麒麟Linux系统;

2 下载WebScannerService服务

按照应用界面的提示下载WebScannerService安装包。

安装提示
安装提示

点击“下载链接”下载WebScannerService安装包WebScannerService_1.0.0_amd64.deb(具体版本以网页中链接为准)文件。

安装包
安装包

3 安装WebScannerService服务

3.1 安装准备(安装依赖包)

test@test-PC:~$ sudo apt-get -y install libsane-common libsane1 libinsane1 libinsane1-dev sane sane-utils

test@test-PC:~$ sudo apt-get -y install xsane libsane-extras

test@test-PC:~$ sudo apt-get -y install hplip libsane-hpaio

test@test-PC:~$ sudo apt-get -y install libnss-mdns

test@test-PC:~$ sudo apt-get -y install libinsane1

test@test-PC:~$ sudo apt-get -y install libcairo2-dev

test@test-PC:~$ sudo apt-get update

test@test-PC:~$ sudo apt-get -y install python3-gi python3-gi-cairo gir1.2-gtk-3.0

test@test-PC:~$ sudo apt-get -y install libgirepository1.0-dev

test@test-PC:~$ sudo apt-get -y install libgobject-introspection-1.0-dev

3.2 命令行方式安装

安装 WebScannerService服务包 , 安装后服务会自动启动

test@test-PC:~/Downloads/$ sudo dpkg -i WebScannerService_1.0.0_amd64.deb

正在选中未选择的软件包 webscannerservice。

(正在读取数据库 ... 系统当前共安装有 299212 个文件和目录。)

准备解压 WebScannerService_1.0.0_amd64.deb ...

web scanner service prepare installing

正在解压 webscannerservice (1.0.0) ...

正在设置 webscannerservice (1.0.0) ...

web scanner service installed

is first install? yes

Created symlink /etc/systemd/system/multi-user.target.wants/wss.service → /etc/systemd/system/wss.service.

test@test-PC:~/Downloads/$

3.3 图形方式安装

右击安装包文件WebScannerService_1.0.0_amd64.deb,选择菜单“打开方式 -> 软件包安装器”并点击,开始安装。 

安装程序
安装程序
安装程序
安装程序

点击“安装”,

安装程序
安装程序

输入安装用户的密码,点击“确定”继续安装,安装进度如下:

安装程序
安装程序
安装程序
安装程序

安装完成后界面如上图,点击“完成”结束安装。 此时WebScannerService服务已安装到系统上,并会自动启动服务。

4 启动WebScannerService服务

在Linux系统中,使用systemctl管理服务。

test@test-PC:~/Downloads/$ sudo systemctl start wss.service

查看服务状态

sudo systemctl status wss.service

● wss.service - wss Service

Loaded: loaded (/etc/systemd/system/wss.service; enabled; preset: enabled)

Active: active (running) since Fri 2025-01-17 13:51:57 CST; 1min 17s ago

Main PID: 439025 (start_runserver)

Tasks: 1 (limit: 9364)

Memory: 1.6M (peak: 1.8M)

CPU: 12ms

CGroup: /system.slice/wss.service

└─439025 /bin/bash /opt/wss/start_runserver_wss

1月 17 13:51:57 test-PC systemd[1]: Started wss.service - wss Service.

1月 17 13:51:57 test-PC su[439026]: (to root) root on none

1月 17 13:51:57 test-PC su[439026]: pam_unix(su-l:session): session opened for user root(uid=0) by (uid=0)

5 服务开机自动启动

test@test-PC:~/Downloads/$ sudo systemctl enable wss.service

查看服务状态

sudo systemctl status wss.service

● wss.service - wss Service

Loaded: loaded (/etc/systemd/system/wss.service; enabled; preset: enabled)

Active: active (running) since Fri 2025-01-17 13:51:57 CST; 1min 17s ago

Main PID: 439025 (start_runserver)

Tasks: 1 (limit: 9364)

Memory: 1.6M (peak: 1.8M)

CPU: 12ms

CGroup: /system.slice/wss.service

└─439025 /bin/bash /opt/wss/start_runserver_wss

1月 17 13:51:57 test-PC systemd[1]: Started wss.service - wss Service.

1月 17 13:51:57 test-PC su[439026]: (to root) root on none

1月 17 13:51:57 test-PC su[439026]: pam_unix(su-l:session): session opened for user root(uid=0) by (uid=0)

注意:安装程序已经默认将服务配置为自动开机启动,若您不需要服务开机自启,可将服务类型设置为手动。

6 停止WebScannerService服务

test@test-PC:~/Downloads/$ sudo systemctl stop wss.service

查看服务状态

sudo systemctl status wss.service

× wss.service - wss Service

Loaded: loaded (/etc/systemd/system/wss.service; enabled; preset: enabled)

Active: failed (Result: signal) since Fri 2025-01-17 14:02:02 CST; 6s ago

Duration: 4min 19.200s

Main PID: 460072 (code=killed, signal=KILL)

CPU: 56ms

1月 17 13:57:43 test-PC systemd[1]: Started wss.service - wss Service.

1月 17 13:57:43 test-PC su[460073]: (to root) root on none

1月 17 13:57:43 test-PC su[460073]: pam_unix(su-l:session): session opened for user root(uid=0) by (uid=0)

1月 17 14:02:02 test-PC systemd[1]: Stopping wss.service - wss Service...

1月 17 14:02:02 test-PC systemd[1]: wss.service: Main process exited, code=killed, status=9/KILL

1月 17 14:02:02 test-PC systemd[1]: wss.service: Control process exited, code=killed, status=9/KILL

1月 17 14:02:02 test-PC systemd[1]: wss.service: Failed with result 'signal'.

1月 17 14:02:02 test-PC systemd[1]: Stopped wss.service - wss Service.

7 重启WebScannerService服务

test@test-PC:~/Downloads/$ sudo systemctl restart wss.service

查看服务状态

sudo systemctl status wss.service

● wss.service - wss Service

Loaded: loaded (/etc/systemd/system/wss.service; enabled; preset: enabled)

Active: active (running) since Fri 2025-01-17 13:51:57 CST; 1min 17s ago

Main PID: 439025 (start_runserver)

Tasks: 1 (limit: 9364)

Memory: 1.6M (peak: 1.8M)

CPU: 12ms

CGroup: /system.slice/wss.service

└─439025 /bin/bash /opt/wss/start_runserver_wss

1月 17 13:51:57 test-PC systemd[1]: Started wss.service - wss Service.

1月 17 13:51:57 test-PC su[439026]: (to root) root on none

1月 17 13:51:57 test-PC su[439026]: pam_unix(su-l:session): session opened for user root(uid=0) by (uid=0)

8 查看WebScannerService工作日志

test@test-PC:~/Downloads/$ tail -f /opt/wss/log/app.log

只需要确保服务正在运行,页面里才可以正常进行扫描操作。

这时刷新页面,WebScanner就会加载电脑安装的扫描仪设备出来了。

展示扫描仪下拉框可见

这里加了2个扫描仪驱动 Epson DS057W 、EPSON DS-570W:004:002

这里我们选择EPSON DS057W,然后点击“扫描”按钮进行扫描,发现编辑器中可以展示出扫描的图像来了。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1 在Linux系统访问WebScanner应用¶
  • 2 下载WebScannerService服务¶
  • 3 安装WebScannerService服务¶
    • 3.1 安装准备(安装依赖包)¶
    • 3.2 命令行方式安装¶
    • 3.3 图形方式安装¶
  • 4 启动WebScannerService服务¶
  • 5 服务开机自动启动¶
  • 6 停止WebScannerService服务¶
  • 7 重启WebScannerService服务¶
  • 8 查看WebScannerService工作日志¶
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档