From b41557b79b3fd4c61b58e243fdb5f66579f254de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C5=A0mahel?= <48548230+ceskyDJ@users.noreply.github.com> Date: Mon, 31 May 2021 13:55:06 +0200 Subject: [PATCH 1/4] Added translation for "Transparency Unit" --- packages/client/src/locales/cs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/locales/cs.json b/packages/client/src/locales/cs.json index 7037b716..91237e37 100644 --- a/packages/client/src/locales/cs.json +++ b/packages/client/src/locales/cs.json @@ -88,7 +88,7 @@ "left-aligned": "zarovnáno vlevo", "centrally-aligned": "zarovnáno na střed", "duplex": "oboustranně", - "transparency unit": "Transparency Unit", + "transparency unit": "Transparentní jednotka", "automatic document feeder": "@:source.adf", "automatic document feeder(left aligned)": "@:source.adf (@:source.left-aligned)", From 55fbbd0f856ed62c2e5c0a3881ecb5b467fff517 Mon Sep 17 00:00:00 2001 From: Michael Bugert Date: Tue, 1 Jun 2021 21:50:26 +0200 Subject: [PATCH 2/4] Extend documentation #289 --- docs/config.md | 23 ++++++++++++++ docs/docker.md | 81 +++++++++++++++++++++++++++++++++++++++++++------- docs/sane.md | 7 +++++ 3 files changed, 101 insertions(+), 10 deletions(-) diff --git a/docs/config.md b/docs/config.md index 20320071..191a45bb 100644 --- a/docs/config.md +++ b/docs/config.md @@ -175,6 +175,29 @@ pipelines at the top of the list. }, ``` +#### Pipeline using "ocrmypdf" +[ocrmypdf](https://github.com/jbarlow83/OCRmyPDF) is a tool which deskews crooked scans, +automatically fixes incorrectly rotated pages and performs OCR with tesseract. It needs +to be installed separately, see the [official instructions](https://ocrmypdf.readthedocs.io/en/latest/installation.html). + +Then, add the following pipeline: +```javascript + const pipelines = [ + { + extension: 'pdf', + description: 'ocrmypdf (JPG | @:pipeline.high-quality)', + get commands() { + return [ + 'convert @- -quality 92 tmp-%d.jpg && ls tmp-*.jpg', + 'convert @- pdf:-', + `ocrmypdf -l ${config.ocrLanguage} --deskew --rotate-pages - scan_0000.pdf`, + 'ls scan_*.*' + ]; + } + } + ]; +``` + ### Change the log level and default scan filename ```javascript diff --git a/docs/docker.md b/docs/docker.md index 966045a3..b05a64b5 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -40,9 +40,9 @@ container needs to access the host hardware. The "simple" solution is to run with `--privileged` but that gives your container full root access to the host - you're putting a lot of trust in the container. In short, best not. -Depending on your setup you have a number of options. +Depending on your setup you have a number of options: -* If your scanner is connected by USB to the host, and there are standard SANE +* If your scanner is **connected by USB to the host**, and there are standard SANE drivers, then you can map the device. The best way to do this is to map the actual USB ports. * Run `sudo sane-find-scanner -q` and you will get a result like @@ -57,26 +57,35 @@ Depending on your setup you have a number of options. [this](https://github.com/sbs20/scanservjs/issues/221#issuecomment-828757430) helpful answer for more. -* If your scanner is driverless over the network, then +* If your scanner is **driverless over the network**, then [sane-airscan](https://github.com/alexpevzner/sane-airscan) should be able to figure it out - but it uses Avahi / Zeroconf / Bonjour to discover devices on the local network. You will want to share dbus to make it work (`-v /var/run/dbus:/var/run/dbus`). -* If your container is running inside a VM you may find that the USB device id +* If your container is **running inside a VM** you may find that the USB device id is [unstable](https://github.com/sbs20/scanservjs/issues/66) and changes between boots. In these cases, you will probably find it easier to share the scanner over the network on the host. +* If you need **proprietary drivers** for your scanner then the best solution is + either to install the drivers on the host and share it over the network or to + create your own docker image based on the scanservjs one and add it in that way. + + Here is an example on how one particular Brother scanner model and its driver + can be installed in the Dockerfile. The driver (`brscan4-0.4.10-1.amd64.deb`) + needs to be placed next to the Dockerfile, then: + ```dockerfile + COPY brscan4-0.4.10-1.amd64.deb "$APP_DIR/brscan4-0.4.10-1.amd64.deb" + RUN apt install -yq "$APP_DIR/brscan4-0.4.10-1.amd64.deb" \ + && brsaneconfig4 -a name=ADS-2600W model=ADS-2600W nodename=10.0.100.30 + ``` + Note: The addition of more backends to the docker container is not planned + since it would mostly add cruft for most users who don't need it. + * Driverless-mode scanning (using airscan over IPP-USB) seems to result in problems. If anyone has ideas why (perhaps something additional needs sharing from host to guest) then suggestions are welcome. - -* If you need proprietary drivers for your scanner then the best solution is - either to create your own docker image based on the scanservjs one and add it - in that way, or to install the drivers on the host and share it over the - network. Adding more backends to the docker container feels wrong and will add - cruft for many users who don't need it. * The best fallback position for most cases is simply to [share the host scanner over the network](https://github.com/sbs20/scanservjs/blob/master/docs/sane.md#configuring-the-server) @@ -178,6 +187,58 @@ docker run -d -p 8080:8080 \ --name scanservjs-container --privileged sbs20/scanservjs:latest ``` +### Hosting it on a Synology NAS using Docker + +It can be convenient to host scanservjs on the same machine where you store your +scans — your NAS. Here's a possible approach for network scanning with a Synology NAS: +1. Install the [Synology Docker package](https://www.synology.com/en-us/dsm/packages/Docker). +2. In DSM, create a service user "scanservjs" which will run the Docker container. + Make sure to give it write permission to the preferred target location for + scans. We'll use `/volume1/scans`. +3. SSH with an admin account onto the NAS and use `id` to determine the UID and + GID of the service user just created: + ```sh + admin@synology:~$ id scanservjs + uid=1034(scanservjs) gid=100(users) groups=100(users),65538(scanusers) + ``` + Keep the session open, we'll need it again in a moment. +4. On your workstation, download and extract [the latest scanservjs release](https://github.com/sbs20/scanservjs/releases/latest). +5. In the repository root, create a text file named `docker-compose.yml` with the + following content: + ```yaml + version: "3" + services: + scanservjs: + build: + context: . + args: + # ----- enter UID and GID here ----- + UID: 1034 + GID: 100 + container_name: scanservjs + environment: + # ----- specify network scanners here; see above for more possibilities ----- + - SANED_NET_HOSTS="10.0.100.30" + volumes: + # ---- enter your target location for scans before the ':' character ----- + - /volume1/scans:/app/data/output + - ./config:/app/config + ports: + - 8080:8080 + restart: unless-stopped + ``` +6. Copy the entire repository including `docker-compose.yml` onto your NAS (via + smb, sftp, ...). +7. In your SSH session from earlier, `cd` to the repository location and run + ```sh + sudo docker-compose up -d + ``` +8. After a medium-sized cup of tea, scanservjs should be available at `http://:8080` +9. Bonus: Create a reverse proxy rule in the [Application Portal](https://www.synology.com/en-global/knowledgebase/DSM/help/DSM/AdminCenter/application_appportalias) + so that scanservjs can be reached via `http://scan.synology.lan` (or similar). + NAS devices are not the most powerful CPU-wise, so consider setting the proxy + timeouts to 300 seconds or more [to prevent timeout issues](troubleshooting.md). + ## Staging builds These may be less stable, but also have upcoming features. diff --git a/docs/sane.md b/docs/sane.md index 8aae7de2..cd1d72aa 100644 --- a/docs/sane.md +++ b/docs/sane.md @@ -79,6 +79,13 @@ such cases you will need to get the device name from the host, prefix it with > file, the only way to access it is by its full device name. You may need to > consult your system administrator to find out the names of such devices. +## Scanners requiring additional drivers + +Some scanner models require additional drivers to function with SANE. For +example, Brother offers proprietary drivers for their USB and network scanners. +Please follow the manufacturer's instructions for setting up such scanners. +Once a scanner is listed in `scanimage -L`, it should be ready to use with +scanservjs. ## SANE Airscan From 2944a468dc4fb1e62b3f323c05a4639f47a16e80 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sat, 5 Jun 2021 11:27:49 +0100 Subject: [PATCH 3/4] md reformat & copy edits --- docs/config.md | 40 ++++++++++++++++++++-------------------- docs/docker.md | 47 +++++++++++++++++++++++++++-------------------- 2 files changed, 47 insertions(+), 40 deletions(-) diff --git a/docs/config.md b/docs/config.md index 191a45bb..2e36b387 100644 --- a/docs/config.md +++ b/docs/config.md @@ -29,7 +29,8 @@ two functions at different stages in the processing: function before being either used or sent down tot he browser. * `afterDevices(devices)`: whenever the devices are read, the result is passed to this function before being used. -* See [example source](../packages/server/config/config.default.js) for more options. +* See [example source](../packages/server/config/config.default.js) for more + options. * Please note that the config file only gets read at start-up - so if you make changes, you will need to restart. @@ -147,8 +148,8 @@ can be anything you want it to be. You just need to override it. You may wish to add your own custom pipelines. Pipelines are arrays of shell commands which run after scans. To learn more read the -[example source](../packages/server/config/config.default.js). This will insert your own -pipelines at the top of the list. +[example source](../packages/server/config/config.default.js). This will insert +your own pipelines at the top of the list. ```javascript afterConfig(config) { @@ -176,26 +177,25 @@ pipelines at the top of the list. ``` #### Pipeline using "ocrmypdf" -[ocrmypdf](https://github.com/jbarlow83/OCRmyPDF) is a tool which deskews crooked scans, -automatically fixes incorrectly rotated pages and performs OCR with tesseract. It needs -to be installed separately, see the [official instructions](https://ocrmypdf.readthedocs.io/en/latest/installation.html). +[ocrmypdf](https://github.com/jbarlow83/OCRmyPDF) is a tool which deskews +crooked scans, automatically fixes incorrectly rotated pages and performs OCR +with tesseract. It needs to be installed separately, see the +[official instructions](https://ocrmypdf.readthedocs.io/en/latest/installation.html). Then, add the following pipeline: ```javascript - const pipelines = [ - { - extension: 'pdf', - description: 'ocrmypdf (JPG | @:pipeline.high-quality)', - get commands() { - return [ - 'convert @- -quality 92 tmp-%d.jpg && ls tmp-*.jpg', - 'convert @- pdf:-', - `ocrmypdf -l ${config.ocrLanguage} --deskew --rotate-pages - scan_0000.pdf`, - 'ls scan_*.*' - ]; - } - } - ]; + config.pipelines.push({ + extension: 'pdf', + description: 'ocrmypdf (JPG | @:pipeline.high-quality)', + get commands() { + return [ + 'convert @- -quality 92 tmp-%d.jpg && ls tmp-*.jpg', + 'convert @- pdf:-', + `ocrmypdf -l ${config.ocrLanguage} --deskew --rotate-pages - scan_0000.pdf`, + 'ls scan_*.*' + ]; + } + }); ``` ### Change the log level and default scan filename diff --git a/docs/docker.md b/docs/docker.md index 596f47f5..a6d6b99a 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -42,9 +42,9 @@ you're putting a lot of trust in the container. In short, best not. Depending on your setup you have a number of options: -* If your scanner is **connected by USB to the host**, and there are standard SANE - drivers, then you can map the device. The best way to do this is to map the - actual USB ports. +* If your scanner is **connected by USB to the host**, and there are standard + SANE drivers, then you can map the device. The best way to do this is to map + the actual USB ports. * Run `sudo sane-find-scanner -q` and you will get a result like `found USB scanner (vendor=0x04a9 [Canon], product=0x220d [CanoScan], chip=LM9832/3) at libusb:001:003`. * Or run `lsusb` which gives you @@ -63,14 +63,15 @@ Depending on your setup you have a number of options: the local network. You will want to share dbus to make it work (`-v /var/run/dbus:/var/run/dbus`). -* If your container is **running inside a VM** you may find that the USB device id - is [unstable](https://github.com/sbs20/scanservjs/issues/66) and changes +* If your container is **running inside a VM** you may find that the USB device + id is [unstable](https://github.com/sbs20/scanservjs/issues/66) and changes between boots. In these cases, you will probably find it easier to share the scanner over the network on the host. * If you need **proprietary drivers** for your scanner then the best solution is either to install the drivers on the host and share it over the network or to - create your own docker image based on the scanservjs one and add it in that way. + create your own docker image based on the scanservjs one and add it in that + way. Here is an example on how one particular Brother scanner model and its driver can be installed in the Dockerfile. The driver (`brscan4-0.4.10-1.amd64.deb`) @@ -193,21 +194,25 @@ docker run -d -p 8080:8080 \ ### Hosting it on a Synology NAS using Docker It can be convenient to host scanservjs on the same machine where you store your -scans — your NAS. Here's a possible approach for network scanning with a Synology NAS: -1. Install the [Synology Docker package](https://www.synology.com/en-us/dsm/packages/Docker). -2. In DSM, create a service user "scanservjs" which will run the Docker container. - Make sure to give it write permission to the preferred target location for - scans. We'll use `/volume1/scans`. +scans — your NAS. Here's a possible approach for network scanning with a +Synology NAS: + +1. Install the + [Synology Docker package](https://www.synology.com/en-us/dsm/packages/Docker). +2. In DSM, create a service user "scanservjs" which will run the Docker + container. Make sure to give it write permission to the preferred target + location for scans. We'll use `/volume1/scans`. 3. SSH with an admin account onto the NAS and use `id` to determine the UID and GID of the service user just created: ```sh admin@synology:~$ id scanservjs uid=1034(scanservjs) gid=100(users) groups=100(users),65538(scanusers) ``` - Keep the session open, we'll need it again in a moment. -4. On your workstation, download and extract [the latest scanservjs release](https://github.com/sbs20/scanservjs/releases/latest). -5. In the repository root, create a text file named `docker-compose.yml` with the - following content: + Keep the session open, we'll need it again in a moment. +4. On your workstation, download and extract + [the latest scanservjs release](https://github.com/sbs20/scanservjs/releases/latest). +5. In the repository root, create a text file named `docker-compose.yml` with + the following content: ```yaml version: "3" services: @@ -236,11 +241,13 @@ scans — your NAS. Here's a possible approach for network scanning with a Synol ```sh sudo docker-compose up -d ``` -8. After a medium-sized cup of tea, scanservjs should be available at `http://:8080` -9. Bonus: Create a reverse proxy rule in the [Application Portal](https://www.synology.com/en-global/knowledgebase/DSM/help/DSM/AdminCenter/application_appportalias) - so that scanservjs can be reached via `http://scan.synology.lan` (or similar). - NAS devices are not the most powerful CPU-wise, so consider setting the proxy - timeouts to 300 seconds or more [to prevent timeout issues](troubleshooting.md). +8. After a medium-sized cup of tea, scanservjs should be available at + `http://:8080` +9. Bonus: Create a reverse proxy rule in the + [Application Portal](https://www.synology.com/en-global/knowledgebase/DSM/help/DSM/AdminCenter/application_appportalias) + so that scanservjs can be reached via `http://scan.synology.lan` (or + similar). Scanning can be slow, so set the proxy timeouts to 300 seconds or + more [to prevent timeout issues](troubleshooting.md). ## Staging builds From ad27bc42543c79264cdf76dd802d0e05503e19bf Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sat, 5 Jun 2021 11:31:06 +0100 Subject: [PATCH 4/4] Version bump --- package-lock.json | 4 ++-- package.json | 2 +- packages/client/package-lock.json | 4 ++-- packages/client/package.json | 2 +- packages/server/package-lock.json | 4 ++-- packages/server/package.json | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f79f087..bb618a2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "scanservjs", - "version": "2.15.1", + "version": "2.15.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "scanservjs", - "version": "2.15.1", + "version": "2.15.2", "hasInstallScript": true, "license": "GPL-2.0" } diff --git a/package.json b/package.json index 80bc27ec..a80510dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scanservjs", - "version": "2.15.1", + "version": "2.15.2", "description": "scanservjs is a simple web-based UI for SANE which allows you to share a scanner on a network without the need for drivers or complicated installation.", "scripts": { "clean": "rm -rf ./dist", diff --git a/packages/client/package-lock.json b/packages/client/package-lock.json index 275ab957..1ff35fda 100644 --- a/packages/client/package-lock.json +++ b/packages/client/package-lock.json @@ -1,12 +1,12 @@ { "name": "scanservjs", - "version": "2.15.1", + "version": "2.15.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "scanservjs", - "version": "2.15.1", + "version": "2.15.2", "license": "GPL-2.0", "dependencies": { "@mdi/font": "^5.9.55", diff --git a/packages/client/package.json b/packages/client/package.json index ade057e5..b6c723ab 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "scanservjs", - "version": "2.15.1", + "version": "2.15.2", "description": "scanservjs is a simple web-based UI for SANE which allows you to share a scanner on a network without the need for drivers or complicated installation.", "author": "Sam Strachan", "scripts": { diff --git a/packages/server/package-lock.json b/packages/server/package-lock.json index 93f0e0b0..b80a8b85 100644 --- a/packages/server/package-lock.json +++ b/packages/server/package-lock.json @@ -1,12 +1,12 @@ { "name": "scanservjs-server", - "version": "2.15.1", + "version": "2.15.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "scanservjs-server", - "version": "2.15.1", + "version": "2.15.2", "license": "GPL-2.0", "dependencies": { "adm-zip": "^0.5.5", diff --git a/packages/server/package.json b/packages/server/package.json index 73019811..5b0a91d8 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "scanservjs-server", - "version": "2.15.1", + "version": "2.15.2", "description": "scanservjs is a simple web-based UI for SANE which allows you to share a scanner on a network without the need for drivers or complicated installation.", "scripts": { "lint": "gulp lint",