eikek / eikek/docspell

FR merge multiple items into a single multipage attachement

Open
#1,105 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elm
Stars
2.3k
Forks
184
Avg merge
8h 2m
Merged PRs (30d)
4

Description

tldr: if technically possible provide an option for the merging of items to merge attachments into a single multipage document?

long:
i have previously had a hard time to import multipage scans into docspell.
my scanner (a simple canon flatbed controlled with scanservjs) spits out multiple jpgs in a zip container. when let consumedir import this, joex log processing succeeds with creating an item with two individual attachments, but for some reason the tesseract job fails:

```
2021-10-06T14:03:06: ===== Start reprocessing ======
2021-10-06T14:03:06: Loaded item and 2 attachments to reprocess
2021-10-06T14:03:06: Converting file Some(scan_2021-01-29 07.36.04 1.jpg) (image/jpeg) into a PDF
2021-10-06T14:03:07: Storing input to file /tmp/docspell-convert/docspell-tesseract1005841414723466335/infile for running tesseract
2021-10-06T14:03:08: Running external command: tesseract /tmp/docspell-convert/docspell-tesseract1005841414723466335/infile out -l deu pdf txt
2021-10-06T14:03:09: Command `tesseract /tmp/docspell-convert/docspell-tesseract1005841414723466335/infile out -l deu pdf txt` finished: 1
2021-10-06T14:03:09: tesseract stdout:
2021-10-06T14:03:09: tesseract stderr: Tesseract Open Source OCR Engine v4.1.1 with Leptonica Corrupt JPEG data: premature end of data segment Error in pixReadStreamJpeg: read error at scanline 2624; nwarn = 1 Error in pixReadStreamJpeg: bad data Error in pixReadStream: jpeg: no pix returned Error in pixRead: pix not read Error during processing.
2021-10-06T14:03:09: PDF conversion failed: Command result=1. No output file found.. Go without PDF file
2021-10-06T14:03:09: Closing process: `tesseract /tmp/docspell-convert/docspell-tesseract1005841414723466335/infile out -l deu pdf txt`
2021-10-06T14:03:09: Converting file Some(scan_2021-01-29 07.36.04 2.jpg) (image/jpeg) into a PDF
2021-10-06T14:03:09: Storing input to file /tmp/docspell-convert/docspell-tesseract11874634666246798395/infile for running tesseract
2021-10-06T14:03:09: Running external command: tesseract /tmp/docspell-convert/docspell-tesseract11874634666246798395/infile out -l deu pdf txt
2021-10-06T14:03:10: Command `tesseract /tmp/docspell-convert/docspell-tesseract11874634666246798395/infile out -l deu pdf txt` finished: 1
2021-10-06T14:03:10: tesseract stdout:
2021-10-06T14:03:10: tesseract stderr: Tesseract Open Source OCR Engine v4.1.1 with Leptonica Corrupt JPEG data: premature end of data segment Error in pixReadStreamJpeg: read error at scanline 2800; nwarn = 2 Error in pixReadStreamJpeg: bad data Error in pixReadStream: jpeg: no pix returned Error in pixRead: pix not read Error during processing.
2021-10-06T14:03:10: PDF conversion failed: Command result=1. No output file found.. Go without PDF file
```

so the item is there, but there are no available previews/pdfs generated. downloading the original archive or the individual original extracted files work fine and they are good.

when i put these images individually into the consumedir, all is well, gets imported, items get created, previews and pdfs generated.

it dawned on me when i did see the created item, however, that docspell will always just add the individual jpg's as individual attachments to an item, so hence my question: is it possible to add an option to merge them? or what is the way to import them to create multipage attachments, rather than per page attachments ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.