Skip to content

Commit

Permalink
Merge pull request #298 from sbs20/staging
Browse files Browse the repository at this point in the history
Docs + translation
  • Loading branch information
sbs20 authored Jun 5, 2021
2 parents c39eb63 + 27a75ba commit 82ef0c4
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 26 deletions.
29 changes: 26 additions & 3 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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) {
Expand All @@ -175,6 +176,28 @@ 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
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

```javascript
Expand Down
94 changes: 81 additions & 13 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ 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
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
Expand All @@ -57,26 +57,36 @@ 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
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.

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)
Expand Down Expand Up @@ -181,6 +191,64 @@ 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://<NAS IP Address>: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
These may be less stable, but also have upcoming features.
Expand Down
7 changes: 7 additions & 0 deletions docs/sane.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
4 changes: 2 additions & 2 deletions packages/server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 82ef0c4

Please sign in to comment.