the-paperless-project / paperless

Scan, index, and archive all of your paper documents
GNU General Public License v3.0
7.85k stars 498 forks source link

need advice for PAPERLESS_PRE_CONSUME_SCRIPT #623

Open keiser1080 opened 4 years ago

keiser1080 commented 4 years ago

Hi, I want to compress on the fly the pdf file . I diden't found an inbuilt function to store the pdf in compressed format like tar.gz. I have try multiple format. And the best options seem's to be: 1.scan the document in color 300 dpi on my brother printer using scan to ocr toward my laptop 2.shrink the pdf using ghostscript script in the pre or post consume phase

but when i use the following script, the log is showing "Skipping /consume/ocr300couleur.pdf as it is not a file"

it's like the file is processed multiple time.

#!/usr/bin/env bash

origin=${1}
filepath=${origin%/*}
filename=${origin##*/}
tmpname="/tmp/tmp_${filename}"
/usr/bin/gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -q -o $tmpname ${1} && mv $tmpname ${1}

could you help?

Tooa commented 4 years ago

the log is showing "Skipping /consume/ocr300couleur.pdf as it is not a file"

The message originates either from document_consumer.py or consumer.py

Do you have an idea why one of these conditions in code might is false?