Accept scanned images in Paperless handoff
Test and deploy / test (push) Successful in 11s
Test and deploy / deploy (push) Failing after 17s

This commit is contained in:
feedc0de committed 2026-10-04 19:33:13 +02:00
1 parent d503184a18
commit bb40a701a8
3 files changed
+12 -9

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@ The 20 Gi PVC uses `rook-cephfs-ec`, whose CephFS data pool is erasure coded wit
The [ScanservJS](https://sbs20.github.io/scanservjs/) web UI is at <https://scanner.brunner.ninja>. Point its DNS CNAME at the same target as `paper.brunner.ninja`. Traefik requires Authentik login and access to the **Paperless Users** group. The scanner's eSCL address is set once as `AIRSCAN_DEVICES` in `app.yaml`; update it there if the printer gets a new IP. The UI pulls scans directly from the HP OfficeJet Pro 8020 at `192.168.4.189:8080`, without HP cloud services or a running laptop.
Load the automatic document feeder, choose the HP scanner, its feeder source, **Auto** batch mode, and a **PDF** output format, then press **Scan**. The feeder batch becomes one multipage PDF. Review the staged result in the Files view, then use **Send to Paperless**. This moves the PDF into the existing Paperless consume directory; Paperless polls it every 30 seconds and handles OCR. The scan remains in staging until you send or delete it. ScanservJS does not offer reliable individual-page deletion or retry before sending: rescan the batch, or edit/split the PDF after import in Paperless. The OfficeJet Pro 8020's feeder is single-sided. This workflow starts scans from the web UI rather than a button on the printer panel.
Load the automatic document feeder, choose the HP scanner, its feeder source, **Auto** batch mode, and a **PDF** output format, then press **Scan**. The feeder batch becomes one multipage PDF. For one page, JPG and other Paperless-supported images also work. Review the staged result in the Files view, select its row, then choose **Action selected → Send to Paperless**. This moves the file into the existing Paperless consume directory; Paperless polls it every 30 seconds and handles OCR. The scan remains in staging until you send or delete it. ScanservJS does not offer reliable individual-page deletion or retry before sending: rescan the batch, or edit/split the PDF after import in Paperless. The OfficeJet Pro 8020's feeder is single-sided. This workflow starts scans from the web UI rather than a button on the printer panel.
ScanservJS stores staged scans in the `scanner-staging` directory on the same retained CephFS claim. The deployment uses the pinned upstream image; its `config.local.js` action is in `app.yaml` and has a local handoff test in `test.sh`. The Authentik proxy application is created by `setup-authentik.sh` along with Paperless's OIDC application.
+3 -2
View File
@@ -159,8 +159,9 @@ data:
name: 'Send to Paperless',
async execute(fileInfo) {
const source = await fs.realpath(fileInfo.fullname);
if (!source.startsWith(output + '/') || path.extname(source).toLowerCase() !== '.pdf') {
throw new Error('Only staged PDF files can be sent to Paperless');
const supported = new Set(['.pdf', '.jpg', '.jpeg', '.png', '.tif', '.tiff', '.gif', '.webp']);
if (!source.startsWith(output + '/') || !supported.has(path.extname(source).toLowerCase())) {
throw new Error('Only staged PDFs and images supported by Paperless can be sent');
}
const name = `${Date.now()}-${crypto.randomBytes(6).toString('hex')}-${path.basename(source)}`;
const destination = path.join(consume, name);
+8 -6
View File
@@ -26,13 +26,15 @@ with tempfile.TemporaryDirectory() as temp:
consume = root / "consume"
output.mkdir()
consume.mkdir()
source = output / "test.pdf"
source.write_bytes(b"%PDF-1.4\nscanner handoff test\n")
env = {**os.environ, "SCAN_OUTPUT_DIR": str(output), "PAPERLESS_CONSUME_DIR": str(consume)}
subprocess.run(["node", "--check", str(config_path)], check=True)
subprocess.run(["node", "-e", "require(process.argv[1]).actions[0].execute({fullname: process.argv[2]}).catch(e => {console.error(e); process.exit(1)})", str(config_path), str(source)], check=True, env=env)
delivered = list(consume.glob("*.pdf"))
assert len(delivered) == 1 and delivered[0].read_bytes().startswith(b"%PDF-1.4")
assert not source.exists() and not list(consume.glob("*.part"))
for name, contents in (("test.pdf", b"%PDF-1.4\nscanner handoff test\n"),
("test.jpg", b"\xff\xd8\xffscanner handoff test\xff\xd9")):
source = output / name
source.write_bytes(contents)
subprocess.run(["node", "-e", "require(process.argv[1]).actions[0].execute({fullname: process.argv[2]}).catch(e => {console.error(e); process.exit(1)})", str(config_path), str(source)], check=True, env=env)
delivered = list(consume.glob(f"*{name}"))
assert len(delivered) == 1 and delivered[0].read_bytes() == contents
assert not source.exists() and not list(consume.glob("*.part"))
print("Manifests valid; images pinned; scanner PDF handoff works.")
PY