node-hp-scan-to 1.8.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +272 -51
- package/dist/HPApi.d.ts +13 -3
- package/dist/HPApi.js +106 -28
- package/dist/HPApi.js.map +1 -1
- package/dist/PathHelper.d.ts +7 -4
- package/dist/PathHelper.js +108 -31
- package/dist/PathHelper.js.map +1 -1
- package/dist/commands/adfAutoscanCmd.js +2 -2
- package/dist/commands/adfAutoscanCmd.js.map +1 -1
- package/dist/commands/listenCmd.d.ts +3 -0
- package/dist/commands/listenCmd.js +75 -42
- package/dist/commands/listenCmd.js.map +1 -1
- package/dist/commands/singleScanCmd.js +1 -1
- package/dist/commands/singleScanCmd.js.map +1 -1
- package/dist/commitInfo.json +1 -1
- package/dist/healthcheck.d.ts +2 -1
- package/dist/healthcheck.js +1 -0
- package/dist/healthcheck.js.map +1 -1
- package/dist/hpModels/AdfState.d.ts +4 -0
- package/dist/hpModels/AdfState.js +9 -0
- package/dist/hpModels/AdfState.js.map +1 -0
- package/dist/hpModels/Destination.js +2 -36
- package/dist/hpModels/Destination.js.map +1 -1
- package/dist/hpModels/EnumUtils.d.ts +3 -0
- package/dist/hpModels/EnumUtils.js +13 -0
- package/dist/hpModels/EnumUtils.js.map +1 -0
- package/dist/hpModels/EsclManifest.d.ts +45 -0
- package/dist/hpModels/EsclManifest.js +43 -0
- package/dist/hpModels/EsclManifest.js.map +1 -0
- package/dist/hpModels/EsclScanCaps.d.ts +37 -0
- package/dist/hpModels/EsclScanCaps.js +83 -0
- package/dist/hpModels/EsclScanCaps.js.map +1 -0
- package/dist/hpModels/EsclScanImageInfo.d.ts +17 -0
- package/dist/hpModels/EsclScanImageInfo.js +26 -0
- package/dist/hpModels/EsclScanImageInfo.js.map +1 -0
- package/dist/hpModels/EsclScanJobSettings.d.ts +16 -0
- package/dist/hpModels/EsclScanJobSettings.js +95 -0
- package/dist/hpModels/EsclScanJobSettings.js.map +1 -0
- package/dist/hpModels/EsclScanStatus.d.ts +75 -0
- package/dist/hpModels/EsclScanStatus.js +98 -0
- package/dist/hpModels/EsclScanStatus.js.map +1 -0
- package/dist/hpModels/EventTable.js +2 -5
- package/dist/hpModels/EventTable.js.map +1 -1
- package/dist/hpModels/IScanJobSettings.d.ts +5 -0
- package/dist/hpModels/IScanJobSettings.js +3 -0
- package/dist/hpModels/IScanJobSettings.js.map +1 -0
- package/dist/hpModels/IScanStatus.d.ts +9 -0
- package/dist/hpModels/IScanStatus.js +3 -0
- package/dist/hpModels/IScanStatus.js.map +1 -0
- package/dist/hpModels/Job.d.ts +11 -2
- package/dist/hpModels/Job.js +18 -7
- package/dist/hpModels/Job.js.map +1 -1
- package/dist/hpModels/ParseXmlString.d.ts +1 -0
- package/dist/hpModels/ParseXmlString.js +17 -0
- package/dist/hpModels/ParseXmlString.js.map +1 -0
- package/dist/hpModels/ScanCaps.d.ts +1 -0
- package/dist/hpModels/ScanCaps.js +5 -5
- package/dist/hpModels/ScanCaps.js.map +1 -1
- package/dist/hpModels/ScanJobManifest.d.ts +1 -0
- package/dist/hpModels/ScanJobManifest.js +9 -5
- package/dist/hpModels/ScanJobManifest.js.map +1 -1
- package/dist/hpModels/ScanJobSettings.d.ts +7 -2
- package/dist/hpModels/ScanJobSettings.js +19 -3
- package/dist/hpModels/ScanJobSettings.js.map +1 -1
- package/dist/hpModels/ScanPlexMode.d.ts +4 -0
- package/dist/hpModels/ScanPlexMode.js +9 -0
- package/dist/hpModels/ScanPlexMode.js.map +1 -0
- package/dist/hpModels/ScanStatus.d.ts +6 -3
- package/dist/hpModels/ScanStatus.js +9 -10
- package/dist/hpModels/ScanStatus.js.map +1 -1
- package/dist/hpModels/ScannerState.d.ts +4 -0
- package/dist/hpModels/ScannerState.js +9 -0
- package/dist/hpModels/ScannerState.js.map +1 -0
- package/dist/hpModels/WalkupScanDestination.d.ts +2 -1
- package/dist/hpModels/WalkupScanDestination.js +5 -6
- package/dist/hpModels/WalkupScanDestination.js.map +1 -1
- package/dist/hpModels/WalkupScanDestinations.js +2 -5
- package/dist/hpModels/WalkupScanDestinations.js.map +1 -1
- package/dist/hpModels/WalkupScanManifest.js +2 -5
- package/dist/hpModels/WalkupScanManifest.js.map +1 -1
- package/dist/hpModels/WalkupScanToCompCaps.js +2 -5
- package/dist/hpModels/WalkupScanToCompCaps.js.map +1 -1
- package/dist/hpModels/WalkupScanToCompDestination.d.ts +2 -1
- package/dist/hpModels/WalkupScanToCompDestination.js +5 -6
- package/dist/hpModels/WalkupScanToCompDestination.js.map +1 -1
- package/dist/hpModels/WalkupScanToCompDestinations.js +2 -5
- package/dist/hpModels/WalkupScanToCompDestinations.js.map +1 -1
- package/dist/hpModels/WalkupScanToCompEvent.d.ts +7 -1
- package/dist/hpModels/WalkupScanToCompEvent.js +13 -6
- package/dist/hpModels/WalkupScanToCompEvent.js.map +1 -1
- package/dist/hpModels/WalkupScanToCompManifest.js +2 -5
- package/dist/hpModels/WalkupScanToCompManifest.js.map +1 -1
- package/dist/index.js +13 -300
- package/dist/index.js.map +1 -1
- package/dist/listening.js +8 -6
- package/dist/listening.js.map +1 -1
- package/dist/pdfProcessing.js +1 -1
- package/dist/pdfProcessing.js.map +1 -1
- package/dist/postProcessing.js +9 -3
- package/dist/postProcessing.js.map +1 -1
- package/dist/program.d.ts +10 -0
- package/dist/program.js +346 -0
- package/dist/program.js.map +1 -0
- package/dist/readDeviceCapabilities.d.ts +1 -1
- package/dist/readDeviceCapabilities.js +56 -4
- package/dist/readDeviceCapabilities.js.map +1 -1
- package/dist/scanJobHandlers.d.ts +4 -3
- package/dist/scanJobHandlers.js +139 -48
- package/dist/scanJobHandlers.js.map +1 -1
- package/dist/scanProcessing.d.ts +10 -5
- package/dist/scanProcessing.js +19 -16
- package/dist/scanProcessing.js.map +1 -1
- package/dist/type/DeviceCapabilities.d.ts +8 -0
- package/dist/type/DiscoveryTree.d.ts +2 -0
- package/dist/type/DiscoveryTree.js +12 -20
- package/dist/type/DiscoveryTree.js.map +1 -1
- package/dist/type/DuplexAssemblyMode.d.ts +33 -0
- package/dist/type/DuplexAssemblyMode.js +38 -0
- package/dist/type/DuplexAssemblyMode.js.map +1 -0
- package/dist/type/FileConfig.d.ts +47 -0
- package/dist/type/FileConfig.js +88 -0
- package/dist/type/FileConfig.js.map +1 -0
- package/dist/type/helpGroupsHeadings.d.ts +10 -0
- package/dist/type/helpGroupsHeadings.js +15 -0
- package/dist/type/helpGroupsHeadings.js.map +1 -0
- package/dist/type/scanConfigs.d.ts +3 -0
- package/dist/type/scanMode.d.ts +4 -0
- package/dist/type/scanMode.js +9 -0
- package/dist/type/scanMode.js.map +1 -0
- package/dist/type/scanTargetDefinitions.d.ts +2 -0
- package/package.json +35 -28
package/README.md
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|

|
|
6
6
|
[](https://www.npmjs.com/package/node-hp-scan-to)
|
|
7
7
|
[](https://hub.docker.com/repository/docker/manuc66/node-hp-scan-to)
|
|
8
|
-
[](https://gitter.im/node-hp-scan-to/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
|
9
8
|
[](https://www.codefactor.io/repository/github/manuc66/node-hp-scan-to)
|
|
10
9
|
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fmanuc66%2Fnode-hp-scan-to?ref=badge_shield)
|
|
11
10
|
|
|
@@ -13,7 +12,8 @@
|
|
|
13
12
|
|
|
14
13
|
Unlike the original HP program, `node-hp-scan-to` is cross-platform and can be run on a bare-metal desktop or server, or in a container on Docker or Kubernetes. It can also be integrated with third-party document management solutions such as [Paperless-ngx](https://docs.paperless-ngx.com/) and [Nextcloud](https://Nextcloud.com/).
|
|
15
14
|
|
|
16
|
-
**Disclaimer:**
|
|
15
|
+
**Disclaimer:** _This project is neither endorsed by nor affiliated with Hewlett-Packard (HP). Any mention or reference to HP is purely descriptive and non-commercial. All reverse engineering of HP's official Windows application and its interaction with devices has been performed independently without cooperation from HP. __This software is provided as-is for educational and personal use only__._
|
|
16
|
+
|
|
17
17
|
|
|
18
18
|
<!-- TOC -->
|
|
19
19
|
|
|
@@ -34,6 +34,7 @@ Unlike the original HP program, `node-hp-scan-to` is cross-platform and can be r
|
|
|
34
34
|
- [Example for Docker](#example-for-docker)
|
|
35
35
|
- [Example for Docker Compose](#example-for-docker-compose)
|
|
36
36
|
- [Run with Kubernetes](#run-with-kubernetes)
|
|
37
|
+
- [Configure](#Configure)
|
|
37
38
|
- [Build Source Code](#build-source-code)
|
|
38
39
|
- [Debugging](#debugging)
|
|
39
40
|
- [💖 Support this project](#-support-this-project)
|
|
@@ -55,9 +56,9 @@ This app has been developed and tested with the following HP All-in-One Printers
|
|
|
55
56
|
|
|
56
57
|
Users have reported it also working on:
|
|
57
58
|
|
|
58
|
-
- HP DeskJet 3050 (J610a), 3775, 4670, 5525
|
|
59
|
-
- HP Envy 4504, 4520, 7640
|
|
60
|
-
- HP OfficeJet 250 Mobile, 3830, 5230, 5740, 6700 Premium, 6950, 8010 series, 8025e, 9012e
|
|
59
|
+
- HP DeskJet 3050 (J610a),3522, 3775, 4670, 5525
|
|
60
|
+
- HP Envy 4504, 4520, 5530, 7640
|
|
61
|
+
- HP OfficeJet 250 Mobile, 3830, 5230, 5740, 6700 Premium, 6950, Pro 7730, 8010 series, 8025e, 9012e
|
|
61
62
|
- HP PageWide 377dw MFP
|
|
62
63
|
|
|
63
64
|
There is a good chance it also works on other unlisted HP All-in-One Printer.
|
|
@@ -81,6 +82,16 @@ There is a good chance it also works on other unlisted HP All-in-One Printer.
|
|
|
81
82
|
- Local folders
|
|
82
83
|
- [Paperless-ngx API](https://docs.paperless-ngx.com/api/) upload
|
|
83
84
|
- [Nextcloud WebDAV](https://docs.Nextcloud.com/server/latest/user_manual/en/files/access_webdav.html) upload
|
|
85
|
+
|
|
86
|
+
### Emulated Duplex Scanning Feature
|
|
87
|
+
|
|
88
|
+
The emulated duplex scanning feature allows users to efficiently scan both sides of a document, even on devices that do not natively support duplex scanning.
|
|
89
|
+
|
|
90
|
+
When enabled (as an opt-in feature), it adds an extra entry in the list of scan destinations, labeled with the "duplex" suffix. When you select this option for the first time, the device scans the front side of the document.
|
|
91
|
+
|
|
92
|
+
After the front side is scanned, if you choose the duplex option again, the device will trigger a second scan and produce an assembled output.
|
|
93
|
+
|
|
94
|
+
If you decide not to scan the back side immediately, the front side scan will be saved in the system and will remain there until you either scan the back side or perform a single side scan instead.
|
|
84
95
|
|
|
85
96
|
## Installation
|
|
86
97
|
|
|
@@ -100,6 +111,19 @@ There is a good chance it also works on other unlisted HP All-in-One Printer.
|
|
|
100
111
|
|
|
101
112
|
- For running with Docker Compose, see the [Example for Docker Compose](#example-for-docker-compose) section
|
|
102
113
|
|
|
114
|
+
### Using Arch Linux (AUR)
|
|
115
|
+
|
|
116
|
+
- The package is available in the Arch User Repository (AUR) as `node-hp-scan-to`
|
|
117
|
+
|
|
118
|
+
- Install it using your preferred AUR helper, for example:
|
|
119
|
+
```bash
|
|
120
|
+
yay -S node-hp-scan-to
|
|
121
|
+
```
|
|
122
|
+
or
|
|
123
|
+
```bash
|
|
124
|
+
paru -S node-hp-scan-to
|
|
125
|
+
```
|
|
126
|
+
|
|
103
127
|
## Usage
|
|
104
128
|
|
|
105
129
|
### Command Line (CLI)
|
|
@@ -121,27 +145,28 @@ Example usage:
|
|
|
121
145
|
|
|
122
146
|
Run `npx node-hp-scan-to --help` to see the full list of options below:
|
|
123
147
|
|
|
124
|
-
| Option
|
|
125
|
-
|
|
126
|
-
| `-a`, `--address`
|
|
127
|
-
| `-d`, `--directory`
|
|
128
|
-
| `-D`, `--debug`
|
|
129
|
-
| `-h`, `--height`
|
|
130
|
-
| `-k`, `--keep-files`
|
|
131
|
-
| `-l`, `--label`
|
|
132
|
-
| `-n`, `--name`
|
|
133
|
-
| `-o`, `--paperless-token`
|
|
134
|
-
| `-p`, `--pattern`
|
|
135
|
-
| `-r`, `--resolution`
|
|
148
|
+
| Option | Description | Example/Default |
|
|
149
|
+
|---------------------------------------|------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
|
|
150
|
+
| `-a`, `--address` | Printer IP address. | `-a 192.168.0.5` (no default) |
|
|
151
|
+
| `-d`, `--directory` | Directory to save scanned documents. Defaults to `/tmp/scan-to-pc<random value>` if not set. | `-d /tmp/scan-to-pc1234` |
|
|
152
|
+
| `-D`, `--debug` | Enable debug logging. | `-D` (disabled by default) |
|
|
153
|
+
| `-h`, `--height` | Scan height in pixels. Defaults to 3507. | `-h 3507` |
|
|
154
|
+
| `-k`, `--keep-files` | Retain scanned files after uploading to Paperless-ngx or Nextcloud (disabled by default). | `-k` (disabled by default) |
|
|
155
|
+
| `-l`, `--label` | The name of the computer running this app. Defaults to the hostname. | `-l <hostname>` (default: system hostname) |
|
|
156
|
+
| `-n`, `--name` | Printer name (quote if it contains spaces). | `-n "Officejet 6500 E710n-z"` (no default) |
|
|
157
|
+
| `-o`, `--paperless-token` | Paperless-ngx API token. | `-o xxxxxxxxxxxx` (no default) |
|
|
158
|
+
| `-p`, `--pattern` | Filename pattern (no extension). Use quotes for static text, supports date/time masks (see [dateformat docs](https://www.npmjs.com/package/dateformat#mask-options)). Defaults to `scan<increasing number>_page<page number>`. | `-p scan1_page1` |
|
|
159
|
+
| `-r`, `--resolution` | Scan resolution in DPI. Defaults to 200. | `-r 200` |
|
|
160
|
+
| `--mode <mode> ` | Selects the scan mode (default: Color) (choices: "Gray", "Color"). | `--mode Gray` |
|
|
136
161
|
| `-s`, `--paperless-post-document-url` | Paperless-ngx API URL for uploading documents. | `-s https://domain.tld/api/documents/post_document/` (no default) |
|
|
137
|
-
| `-t`, `--temp-directory`
|
|
138
|
-
| `-w`, `--width`
|
|
139
|
-
| `--device-up-polling-interval`
|
|
140
|
-
| `--nextcloud-password`
|
|
141
|
-
| `--nextcloud-password-file`
|
|
142
|
-
| `--nextcloud-upload-folder`
|
|
143
|
-
| `--nextcloud-url`
|
|
144
|
-
| `--nextcloud-username`
|
|
162
|
+
| `-t`, `--temp-directory` | Temporary directory for processing. Defaults to `/tmp/scan-to-pc<random value>` if not set. | `-t /tmp/scan-to-pc5678` |
|
|
163
|
+
| `-w`, `--width` | Scan width in pixels. Defaults to 2481. | `-w 2481` |
|
|
164
|
+
| `--device-up-polling-interval` | Polling interval (in milliseconds) to check if the printer is online. | `--device-up-polling-interval 5000` (no default) |
|
|
165
|
+
| `--nextcloud-password` | Nextcloud app password. Required unless `--nextcloud-password-file` is used. Overrides if both are provided. | `--nextcloud-password mypassword` (no default) |
|
|
166
|
+
| `--nextcloud-password-file` | File containing the Nextcloud app password. Required unless `--nextcloud-password` is used. Takes precedence if both are provided. | `--nextcloud-password-file /path/to/file` (no default) |
|
|
167
|
+
| `--nextcloud-upload-folder` | Nextcloud folder for uploads. Defaults to `scan`. | `--nextcloud-upload-folder scan` |
|
|
168
|
+
| `--nextcloud-url` | Nextcloud instance URL. | `--nextcloud-url https://domain.tld` (no default) |
|
|
169
|
+
| `--nextcloud-username` | Nextcloud username with write access to the upload folder. | `--nextcloud-username user` (no default) |
|
|
145
170
|
|
|
146
171
|
**Notes:**
|
|
147
172
|
|
|
@@ -157,18 +182,120 @@ By default, this app runs the `listen` command as the default mode. It will list
|
|
|
157
182
|
|
|
158
183
|
Run `npx node-hp-scan-to listen --help` to get the full list of command options.
|
|
159
184
|
|
|
185
|
+
<!-- BEGIN HELP command: listen -->
|
|
186
|
+
```text
|
|
187
|
+
Usage: listen [options]
|
|
188
|
+
|
|
189
|
+
Listen the device for new scan job to save to this target
|
|
190
|
+
|
|
191
|
+
Output Options:
|
|
192
|
+
-d, --directory <dir> Directory where scans are saved (default: /tmp/scan-to-pcRANDOM)
|
|
193
|
+
-p, --pattern <pattern> Pattern for filename (i.e. "scan"_dd.mm.yyyy_hh:MM:ss, default would be scanPageNUMBER), make sure that the pattern is enclosed in extra quotes
|
|
194
|
+
-k, --keep-files Keep the scan files on the file system when sent to external systems for local backup and easy access (default: false)
|
|
195
|
+
|
|
196
|
+
Scan Options:
|
|
197
|
+
-r, --resolution <dpi> Resolution in DPI of the scans (default: 200)
|
|
198
|
+
--mode <mode> Selects the scan mode (default: Color) (choices: "Gray", "Color")
|
|
199
|
+
-w, --width <width> Width in pixels of the scans (default: max)
|
|
200
|
+
-h, --height <height> Height in pixels of the scans (default: max)
|
|
201
|
+
-t, --temp-directory <dir> Temp directory used for processing (default: /tmp/scan-to-pcRANDOM)
|
|
202
|
+
--prefer-eSCL Prefer eSCL protocol if available
|
|
203
|
+
|
|
204
|
+
Options:
|
|
205
|
+
--device-up-polling-interval <deviceUpPollingInterval> Device up polling interval in milliseconds
|
|
206
|
+
--help display help for command
|
|
207
|
+
|
|
208
|
+
Paperless Options:
|
|
209
|
+
-s, --paperless-post-document-url <paperless_post_document_url> The paperless post document url (example: https://domain.tld/api/documents/post_document/)
|
|
210
|
+
-o, --paperless-token <paperless_token> The paperless token
|
|
211
|
+
--paperless-group-multi-page-scan-into-a-pdf Combine multiple scanned images into a single PDF document
|
|
212
|
+
--paperless-always-send-as-pdf-file Always convert scan job to pdf before sending to paperless
|
|
213
|
+
|
|
214
|
+
Nextcloud Options:
|
|
215
|
+
--nextcloud-url <nextcloud_url> The nextcloud url (example: https://domain.tld)
|
|
216
|
+
--nextcloud-username <nextcloud_username> The nextcloud username
|
|
217
|
+
--nextcloud-password <nextcloud_app_password> The nextcloud app password for username. Either this or nextcloud-password-file is required
|
|
218
|
+
--nextcloud-password-file <nextcloud_app_password_file> File name that contains the nextcloud app password for username. Either this or nextcloud-password is required
|
|
219
|
+
--nextcloud-upload-folder <nextcloud_upload_folder> The upload folder where documents or images are uploaded (default: scan)
|
|
220
|
+
|
|
221
|
+
Device Control Screen Options:
|
|
222
|
+
-l, --label <label> The label to display on the device (the default is the hostname)
|
|
223
|
+
--add-emulated-duplex [mode] Enable emulated duplex scanning, with optional assembly mode (default: document-wise) (choices: "page-wise", "document-wise", "reverse-front", "reverse-both")
|
|
224
|
+
--emulated-duplex-label <label> The emulated duplex label to display on the device (the default is to suffix the main label with duplex)
|
|
225
|
+
|
|
226
|
+
Global Options:
|
|
227
|
+
-a, --address <ip> IP address of the device, when specified, the ip will be used instead of the name
|
|
228
|
+
-n, --name <name> Name of the device to lookup for on the network
|
|
229
|
+
-D, --debug Enable debug
|
|
230
|
+
--health-check Start an http health check endpoint
|
|
231
|
+
--health-check-port <health-check-port> Define the port for the HTTP health check endpoint
|
|
232
|
+
```
|
|
233
|
+
<!-- END HELP command: listen -->
|
|
234
|
+
|
|
160
235
|
##### `adf-autoscan`
|
|
161
236
|
|
|
162
237
|
Running `npx node-hp-scan-to adf-autoscan` will automatically trigger a scan job as soon as the ADF (automatic document feeder) on the printer's scanner is loaded with paper.
|
|
163
238
|
|
|
164
|
-
Run `npx node-hp-scan-to adf-autoscan --help` to get command line usage help.
|
|
165
|
-
|
|
166
239
|
You can also set the environment variable `MAIN_COMMAND="adf-autoscan"` with Docker. Example:
|
|
167
240
|
|
|
168
241
|
```sh
|
|
169
|
-
docker run -e MAIN_COMMAND="adf-autoscan" CMDLINE=--debug docker.io/manuc66/node-hp-scan-to:latest
|
|
242
|
+
docker run -e MAIN_COMMAND="adf-autoscan" -e CMDLINE=--debug docker.io/manuc66/node-hp-scan-to:latest
|
|
170
243
|
```
|
|
171
244
|
|
|
245
|
+
Run `npx node-hp-scan-to adf-autoscan --help` to get command line usage help.
|
|
246
|
+
|
|
247
|
+
<!-- BEGIN HELP command: adf-autoscan -->
|
|
248
|
+
```text
|
|
249
|
+
Usage: adf-autoscan [options]
|
|
250
|
+
|
|
251
|
+
Automatically trigger a new scan job to this target once paper is detected in
|
|
252
|
+
the automatic document feeder (adf)
|
|
253
|
+
|
|
254
|
+
Output Options:
|
|
255
|
+
-d, --directory <dir> Directory where scans are saved (default: /tmp/scan-to-pcRANDOM)
|
|
256
|
+
-p, --pattern <pattern> Pattern for filename (i.e. "scan"_dd.mm.yyyy_hh:MM:ss, default would be scanPageNUMBER), make sure that the pattern is enclosed in extra quotes
|
|
257
|
+
-k, --keep-files Keep the scan files on the file system when sent to external systems for local backup and easy access (default: false)
|
|
258
|
+
--pdf If specified, the scan result will always be a pdf document, the default depends on the device choice
|
|
259
|
+
|
|
260
|
+
Scan Options:
|
|
261
|
+
-r, --resolution <dpi> Resolution in DPI of the scans (default: 200)
|
|
262
|
+
--mode <mode> Selects the scan mode (default: Color) (choices: "Gray", "Color")
|
|
263
|
+
-w, --width <width> Width in pixels of the scans (default: max)
|
|
264
|
+
-h, --height <height> Height in pixels of the scans (default: max)
|
|
265
|
+
-t, --temp-directory <dir> Temp directory used for processing (default: /tmp/scan-to-pcRANDOM)
|
|
266
|
+
--prefer-eSCL Prefer eSCL protocol if available
|
|
267
|
+
--duplex If specified, all the scans will be in duplex if the device support it
|
|
268
|
+
|
|
269
|
+
Options:
|
|
270
|
+
--device-up-polling-interval <deviceUpPollingInterval> Device up polling interval in milliseconds
|
|
271
|
+
--help display help for command
|
|
272
|
+
|
|
273
|
+
Paperless Options:
|
|
274
|
+
-s, --paperless-post-document-url <paperless_post_document_url> The paperless post document url (example: https://domain.tld/api/documents/post_document/)
|
|
275
|
+
-o, --paperless-token <paperless_token> The paperless token
|
|
276
|
+
--paperless-group-multi-page-scan-into-a-pdf Combine multiple scanned images into a single PDF document
|
|
277
|
+
--paperless-always-send-as-pdf-file Always convert scan job to pdf before sending to paperless
|
|
278
|
+
|
|
279
|
+
Nextcloud Options:
|
|
280
|
+
--nextcloud-url <nextcloud_url> The nextcloud url (example: https://domain.tld)
|
|
281
|
+
--nextcloud-username <nextcloud_username> The nextcloud username
|
|
282
|
+
--nextcloud-password <nextcloud_app_password> The nextcloud app password for username. Either this or nextcloud-password-file is required
|
|
283
|
+
--nextcloud-password-file <nextcloud_app_password_file> File name that contains the nextcloud app password for username. Either this or nextcloud-password is required
|
|
284
|
+
--nextcloud-upload-folder <nextcloud_upload_folder> The upload folder where documents or images are uploaded (default: scan)
|
|
285
|
+
|
|
286
|
+
Auto-scan Options:
|
|
287
|
+
--pollingInterval <pollingInterval> Time interval in millisecond between each lookup for content in the automatic document feeder
|
|
288
|
+
--start-scan-delay <startScanDelay> Once document are detected to be in the adf, this specify the wait delay in millisecond before triggering the scan
|
|
289
|
+
|
|
290
|
+
Global Options:
|
|
291
|
+
-a, --address <ip> IP address of the device, when specified, the ip will be used instead of the name
|
|
292
|
+
-n, --name <name> Name of the device to lookup for on the network
|
|
293
|
+
-D, --debug Enable debug
|
|
294
|
+
--health-check Start an http health check endpoint
|
|
295
|
+
--health-check-port <health-check-port> Define the port for the HTTP health check endpoint
|
|
296
|
+
```
|
|
297
|
+
<!-- END HELP command: adf-autoscan -->
|
|
298
|
+
|
|
172
299
|
##### `clear-registrations`
|
|
173
300
|
|
|
174
301
|
Running `npx node-hp-scan-to clear-registratons` will clear all registered targets on the device (useful for trial and error and debugging).
|
|
@@ -181,11 +308,97 @@ You can also set the environment variable `MAIN_COMMAND="clear-registrations"` w
|
|
|
181
308
|
docker run -e MAIN_COMMAND="clear-registrations" docker.io/manuc66/node-hp-scan-to:latest
|
|
182
309
|
```
|
|
183
310
|
|
|
311
|
+
<!-- BEGIN HELP command: clear-registrations -->
|
|
312
|
+
```text
|
|
313
|
+
Usage: clear-registrations [options]
|
|
314
|
+
|
|
315
|
+
Clear the list or registered target on the device
|
|
316
|
+
|
|
317
|
+
Options:
|
|
318
|
+
-h, --help display help for command
|
|
319
|
+
|
|
320
|
+
Global Options:
|
|
321
|
+
-a, --address <ip> IP address of the device, when specified, the ip will be used instead of the name
|
|
322
|
+
-n, --name <name> Name of the device to lookup for on the network
|
|
323
|
+
-D, --debug Enable debug
|
|
324
|
+
--health-check Start an http health check endpoint
|
|
325
|
+
--health-check-port <health-check-port> Define the port for the HTTP health check endpoint
|
|
326
|
+
```
|
|
327
|
+
<!-- END HELP command: clear-registrations -->
|
|
328
|
+
|
|
329
|
+
##### `single-scan`
|
|
330
|
+
|
|
331
|
+
Running `npx node-hp-scan-to single-scan` will directly issue a single scan job
|
|
332
|
+
|
|
333
|
+
Run `npx node-hp-scan-to single-scan --help` to get command line usage help.
|
|
334
|
+
|
|
335
|
+
You can also set the environment variable `MAIN_COMMAND="single-scan"` with Docker. Example:
|
|
336
|
+
|
|
337
|
+
```sh
|
|
338
|
+
docker run -e MAIN_COMMAND="single-scan" docker.io/manuc66/node-hp-scan-to:latest
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
<!-- BEGIN HELP command: single-scan -->
|
|
342
|
+
```text
|
|
343
|
+
Usage: single-scan [options]
|
|
344
|
+
|
|
345
|
+
Trigger a new scan job
|
|
346
|
+
|
|
347
|
+
Output Options:
|
|
348
|
+
-d, --directory <dir> Directory where scans are saved (default: /tmp/scan-to-pcRANDOM)
|
|
349
|
+
-p, --pattern <pattern> Pattern for filename (i.e. "scan"_dd.mm.yyyy_hh:MM:ss, default would be scanPageNUMBER), make sure that the pattern is enclosed in extra quotes
|
|
350
|
+
-k, --keep-files Keep the scan files on the file system when sent to external systems for local backup and easy access (default: false)
|
|
351
|
+
--pdf If specified, the scan result will always be a pdf document, the default depends on the device choice
|
|
352
|
+
|
|
353
|
+
Scan Options:
|
|
354
|
+
-r, --resolution <dpi> Resolution in DPI of the scans (default: 200)
|
|
355
|
+
--mode <mode> Selects the scan mode (default: Color) (choices: "Gray", "Color")
|
|
356
|
+
-w, --width <width> Width in pixels of the scans (default: max)
|
|
357
|
+
-h, --height <height> Height in pixels of the scans (default: max)
|
|
358
|
+
-t, --temp-directory <dir> Temp directory used for processing (default: /tmp/scan-to-pcRANDOM)
|
|
359
|
+
--prefer-eSCL Prefer eSCL protocol if available
|
|
360
|
+
--duplex If specified, all the scans will be in duplex if the device support it
|
|
361
|
+
|
|
362
|
+
Options:
|
|
363
|
+
--device-up-polling-interval <deviceUpPollingInterval> Device up polling interval in milliseconds
|
|
364
|
+
--help display help for command
|
|
365
|
+
|
|
366
|
+
Paperless Options:
|
|
367
|
+
-s, --paperless-post-document-url <paperless_post_document_url> The paperless post document url (example: https://domain.tld/api/documents/post_document/)
|
|
368
|
+
-o, --paperless-token <paperless_token> The paperless token
|
|
369
|
+
--paperless-group-multi-page-scan-into-a-pdf Combine multiple scanned images into a single PDF document
|
|
370
|
+
--paperless-always-send-as-pdf-file Always convert scan job to pdf before sending to paperless
|
|
371
|
+
|
|
372
|
+
Nextcloud Options:
|
|
373
|
+
--nextcloud-url <nextcloud_url> The nextcloud url (example: https://domain.tld)
|
|
374
|
+
--nextcloud-username <nextcloud_username> The nextcloud username
|
|
375
|
+
--nextcloud-password <nextcloud_app_password> The nextcloud app password for username. Either this or nextcloud-password-file is required
|
|
376
|
+
--nextcloud-password-file <nextcloud_app_password_file> File name that contains the nextcloud app password for username. Either this or nextcloud-password is required
|
|
377
|
+
--nextcloud-upload-folder <nextcloud_upload_folder> The upload folder where documents or images are uploaded (default: scan)
|
|
378
|
+
|
|
379
|
+
Global Options:
|
|
380
|
+
-a, --address <ip> IP address of the device, when specified, the ip will be used instead of the name
|
|
381
|
+
-n, --name <name> Name of the device to lookup for on the network
|
|
382
|
+
-D, --debug Enable debug
|
|
383
|
+
--health-check Start an http health check endpoint
|
|
384
|
+
--health-check-port <health-check-port> Define the port for the HTTP health check endpoint
|
|
385
|
+
```
|
|
386
|
+
<!-- END HELP command: single-scan -->
|
|
387
|
+
|
|
184
388
|
### Run with Docker
|
|
185
389
|
|
|
186
390
|
#### Public Pre-Built Docker image
|
|
187
391
|
|
|
188
|
-
|
|
392
|
+
<https://hub.docker.com/repository/docker/manuc66/node-hp-scan-to>
|
|
393
|
+
|
|
394
|
+
The Docker images follow semantic versioning:
|
|
395
|
+
- `latest`: Latest stable release (includes all patch updates)
|
|
396
|
+
- `x.y.z`: Specific version (e.g., `1.2.3`)
|
|
397
|
+
- `x.y`: Latest patch version of a specific minor version (e.g., `1.2`)
|
|
398
|
+
- `x`: Latest minor.patch version of a specific major version (e.g., `1`)
|
|
399
|
+
- `master`: Latest build from the master branch (development version)
|
|
400
|
+
|
|
401
|
+
Note: For most users, the `latest` tag is recommended as it includes all patch updates and bug fixes.
|
|
189
402
|
|
|
190
403
|
Be aware that with Docker you have to specify the IP address of the printer via the `IP` environment variable, because the Bonjour service discovery protocol uses multicast network traffic, which by default doesn't work in Docker.
|
|
191
404
|
|
|
@@ -197,26 +410,28 @@ All scanned files are written to the volume `/scan`, the filename can be changed
|
|
|
197
410
|
|
|
198
411
|
List of supported environment variables and their meaning, or correspondence with [command-line flags](#cli-options):
|
|
199
412
|
|
|
200
|
-
| Environment Variable
|
|
201
|
-
|
|
202
|
-
| `CMDLINE`
|
|
203
|
-
| `DIR`
|
|
204
|
-
| `IP`
|
|
205
|
-
| `KEEP_FILES`
|
|
206
|
-
| `LABEL`
|
|
207
|
-
| `NAME`
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `
|
|
215
|
-
| `
|
|
216
|
-
| `
|
|
217
|
-
| `
|
|
218
|
-
| `
|
|
219
|
-
| `
|
|
413
|
+
| Environment Variable | Description | Corresponding CLI Flag or Notes |
|
|
414
|
+
|-------------------------------|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
|
|
415
|
+
| `CMDLINE` | Additional command-line flags added at the end of the command | Set to `-D` to enable debug logs |
|
|
416
|
+
| `DIR` | Directory to use | `-d` / `--directory` |
|
|
417
|
+
| `IP` | IP address for the program | `-a` / `--address` |
|
|
418
|
+
| `KEEP_FILES` | If set, scanned files are not deleted after uploading to Paperless-ngx or Nextcloud | |
|
|
419
|
+
| `LABEL` | Label to set on the device's display as a scan target | `-l` / `--label` |
|
|
420
|
+
| `NAME` | Name of the device to lookup for on the network | `-n` / `--name` |
|
|
421
|
+
| `ADD_EMULATED_DUPLEX` | Enable emulated duplex scanning, with optional assembly mode (default: document-wise) | `--add-emulated-duplex [mode]` |
|
|
422
|
+
| `NEXTCLOUD_PASSWORD` | Password of Nextcloud user (either this or `NEXTCLOUD_PASSWORD_FILE` is required; file takes precedence) | |
|
|
423
|
+
| `NEXTCLOUD_PASSWORD_FILE` | File containing Nextcloud user password (either this or `NEXTCLOUD_PASSWORD` is required; takes precedence) | Example: `./nextcloud_password.secret` (preferred for Docker Compose secrets) |
|
|
424
|
+
| `NEXTCLOUD_UPLOAD_FOLDER` | Upload folder for documents or images (user must have write permission; defaults to `scan` if not set) | |
|
|
425
|
+
| `NEXTCLOUD_URL` | Nextcloud URL | Example: `https://nextcloud.example.tld` |
|
|
426
|
+
| `NEXTCLOUD_USERNAME` | Nextcloud username | |
|
|
427
|
+
| `PAPERLESS_POST_DOCUMENT_URL` | Paperless-ngx post document URL (if provided with token, a PDF is uploaded) | Example: `http://<paperless-host>:<port>/api/documents/post_document/` |
|
|
428
|
+
| `PAPERLESS_TOKEN` | Paperless-ngx API token | Example: `xxxxxxxxxxxx...` |
|
|
429
|
+
| `PATTERN` | Pattern to use | `-p` / `--pattern` |
|
|
430
|
+
| `PGID` | ID of the group that will run the program | |
|
|
431
|
+
| `PUID` | ID of the user that will run the program | |
|
|
432
|
+
| `RESOLUTION` | Resolution setting | `-r` / `--resolution` |
|
|
433
|
+
| `MODE` | Scan mode setting | `--mode` |
|
|
434
|
+
| `TEMP_DIR` | Temporary directory | `-t` / `--temp-directory` |
|
|
220
435
|
|
|
221
436
|
**Additional Notes:**
|
|
222
437
|
|
|
@@ -262,8 +477,8 @@ services:
|
|
|
262
477
|
# If you need to pass additional configuration flag use the CMDLINE env, thy will be appened to the
|
|
263
478
|
# - CMDLINE=--debug --pdf
|
|
264
479
|
# If using Paperless-ngx, you can use its API to upload files:
|
|
265
|
-
# - PAPERLESS_POST_DOCUMENT_URL=
|
|
266
|
-
# - PAPERLESS_TOKEN=
|
|
480
|
+
# - PAPERLESS_POST_DOCUMENT_URL=http://<paperless-host>:<port>/api/documents/post_document/
|
|
481
|
+
# - PAPERLESS_TOKEN= xxxxxxxxxxxx...
|
|
267
482
|
volumes:
|
|
268
483
|
- ./scan:/scan
|
|
269
484
|
```
|
|
@@ -322,6 +537,12 @@ spec:
|
|
|
322
537
|
claimName: incoming-scans
|
|
323
538
|
```
|
|
324
539
|
|
|
540
|
+
### Configure
|
|
541
|
+
|
|
542
|
+
Configuration can be done in a config file instead of using command line switches or environment variables in docker. The schema of the configuration file can be found in [FileConfig](src/type/FileConfig.ts)
|
|
543
|
+
|
|
544
|
+
The configuration file is handled by https://www.npmjs.com/package/config
|
|
545
|
+
|
|
325
546
|
## Build Source Code
|
|
326
547
|
|
|
327
548
|
How to build and run the project's source code:
|
package/dist/HPApi.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import WalkupScanDestination from "./hpModels/WalkupScanDestination";
|
|
|
6
6
|
import WalkupScanToCompDestination from "./hpModels/WalkupScanToCompDestination";
|
|
7
7
|
import WalkupScanDestinations from "./hpModels/WalkupScanDestinations";
|
|
8
8
|
import WalkupScanToCompDestinations from "./hpModels/WalkupScanToCompDestinations";
|
|
9
|
-
import ScanJobSettings from "./hpModels/ScanJobSettings";
|
|
10
9
|
import Destination from "./hpModels/Destination";
|
|
11
10
|
import WalkupScanToCompEvent from "./hpModels/WalkupScanToCompEvent";
|
|
12
11
|
import DiscoveryTree from "./type/DiscoveryTree";
|
|
@@ -15,6 +14,11 @@ import WalkupScanToCompCaps from "./hpModels/WalkupScanToCompCaps";
|
|
|
15
14
|
import WalkupScanManifest from "./hpModels/WalkupScanManifest";
|
|
16
15
|
import ScanJobManifest from "./hpModels/ScanJobManifest";
|
|
17
16
|
import ScanCaps from "./hpModels/ScanCaps";
|
|
17
|
+
import EsclScanJobManifest from "./hpModels/EsclManifest";
|
|
18
|
+
import EsclScanCaps from "./hpModels/EsclScanCaps";
|
|
19
|
+
import EsclScanStatus from "./hpModels/EsclScanStatus";
|
|
20
|
+
import { IScanJobSettings } from "./hpModels/IScanJobSettings";
|
|
21
|
+
import EsclScanImageInfo from "./hpModels/EsclScanImageInfo";
|
|
18
22
|
export default class HPApi {
|
|
19
23
|
static setDeviceIP(ip: string): void;
|
|
20
24
|
static setDebug(dbg: boolean): void;
|
|
@@ -29,7 +33,9 @@ export default class HPApi {
|
|
|
29
33
|
static getWalkupScanManifest(uri: string): Promise<WalkupScanManifest>;
|
|
30
34
|
static getWalkupScanToCompManifest(uri: string): Promise<WalkupScanToCompManifest>;
|
|
31
35
|
static getScanJobManifest(uri: string): Promise<ScanJobManifest>;
|
|
36
|
+
static getEsclScanJobManifest(uri: string): Promise<EsclScanJobManifest>;
|
|
32
37
|
static getScanCaps(uri: string): Promise<ScanCaps>;
|
|
38
|
+
static getEsclScanCaps(uri: string): Promise<EsclScanCaps>;
|
|
33
39
|
static getWalkupScanToCompCaps(uri: string): Promise<WalkupScanToCompCaps>;
|
|
34
40
|
static getWalkupScanToCompEvent(compEventURI: string): Promise<WalkupScanToCompEvent>;
|
|
35
41
|
static removeDestination(walkupScanDestination: WalkupScanDestination | WalkupScanToCompDestination): Promise<boolean>;
|
|
@@ -40,12 +46,16 @@ export default class HPApi {
|
|
|
40
46
|
static appendTimeout(url: string, timeout?: number | null): string;
|
|
41
47
|
static getDestination(destinationURL: string): Promise<WalkupScanDestination | WalkupScanToCompDestination>;
|
|
42
48
|
static getScanStatus(): Promise<ScanStatus>;
|
|
49
|
+
static getEsclScanStatus(): Promise<EsclScanStatus>;
|
|
43
50
|
static delay(t: number): Promise<void>;
|
|
44
|
-
static postJob(job:
|
|
51
|
+
static postJob(job: IScanJobSettings): Promise<string>;
|
|
52
|
+
static postEsclJob(job: IScanJobSettings): Promise<string>;
|
|
45
53
|
/**
|
|
46
54
|
* @param jobURL
|
|
47
55
|
* @return {Promise<Job|*>}
|
|
48
56
|
*/
|
|
49
57
|
static getJob(jobURL: string): Promise<Job>;
|
|
50
|
-
static downloadPage(binaryURL: string, destination: string): Promise<string>;
|
|
58
|
+
static downloadPage(binaryURL: string, destination: string, timeout?: number): Promise<string>;
|
|
59
|
+
static downloadEsclPage(jobUri: string, destination: string): Promise<string>;
|
|
60
|
+
static getEsclScanImageInfo(jobUri: string): Promise<EsclScanImageInfo>;
|
|
51
61
|
}
|