paperless/README.md aktualisiert

This commit is contained in:
Borgal
2024-07-17 16:35:18 +00:00
parent 1ae807cc67
commit f2d5f3008d

View File

@@ -9,12 +9,80 @@
<p></p>
<a href="https://docs.paperless-ngx.com/" target="_blank">Paperless ngx</a>
<p></p>
<h3>HowTo</h3>
<h2>HowTo</h2>
<hr>
<p></p>
<h2>/etc/fstab Mount zu Scanner Verzeichniss</h2>
<h4>/etc/fstab Mount zu Scanner Verzeichniss</h4>
<p></p>
<pre>192.168.0.102:/mnt/pool1/scanner /opt/paperless/consume nfs4 auto,mountvers=4.0 0 0</pre>
<pre>192.168.0.102:/mnt/pool1/scanner /opt/paperless/consume nfs auto 0 0</pre>
<p></p>
<h5>gegebenfalls noch die NFS Tools installieren</h5>
<pre>apt install nfs-common</pre>
<pre>apt install nfs-common</pre>
<p></p>
<h4>Script für das entfernen von leeren Seiten</h4>
<p></p>
Added <kbd>/usr/src/paperless/scripts/pre-consume.sh</kbd>
<p></p>
<pre>
#!/bin/sh
set -x
&num; Remove blank pages
/scripts/remove-blank-pages.sh
</pre>
<p></p>
<p></p>
Added <kbd>/usr/src/paperless/scripts/remove-blank-pages.sh</kbd>
<p></p>
<pre>
#!/bin/bash
&num; set -x -e -o pipefail
set -e -o pipefail
export LC_ALL=C
&num; IN="$1"
IN="$DOCUMENT_WORKING_PATH"
&num; Check for PDF format
TYPE=$(file -b "$IN")
if [ "${TYPE%%,*}" != "PDF document" ]; then
>&2 echo "Skipping $IN - non PDF [$TYPE]."
exit 0
fi
&num; PDF file - proceed
&num; PAGES=$(pdfinfo "$IN" | grep ^Pages: | tr -dc '0-9')
PAGES=$(pdfinfo "$IN" | awk '/Pages:/ {print $2}')
>&2 echo Total pages $PAGES
&num; Threshold for HP scanners
THRESHOLD=1
&num; Threshold for Lexmar MC2425
&num; THRESHOLD=0.8
non_blank() {
for i in $(seq 1 $PAGES) ; do
PERCENT=$(gs -o - -dFirstPage=${i} -dLastPage=${i} -sDEVICE=ink_cov "${IN}" | grep CMYK | nawk 'BEGIN { sum=0; } {sum += $1 + $2 + $3 + $4;} END { printf "%.5f\n", sum } ')
>&2 echo -n "Color-sum in page $i is $PERCENT: "
if awk "BEGIN { exit !($PERCENT > $THRESHOLD) }"; then
echo $i
>&2 echo "Page added to document"
else
>&2 echo "Page removed from document"
fi
done
}
NON_BLANK=$(non_blank)
if [ -n "$NON_BLANK" ]; then
NON_BLANK=$(echo $NON_BLANK | tr ' ' ",")
qpdf "$IN" --warning-exit-0 --replace-input --pages . $NON_BLANK --
fi
</pre>