Last active
October 24, 2025 18:58
-
-
Save j4velin/a32f2fd355f5140538586f19d780d6cc to your computer and use it in GitHub Desktop.
Scans the given number of pages and moves the resulting pdf to the input directory for the ocr.sh script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| count=$1 | |
| resolution=150 | |
| if [ $count -gt 1 ]; then | |
| scanimage --batch=scan_%d.tiff --batch-count=$count --format=tiff --resolution $resolution --batch-prompt | |
| resultcode=$? | |
| if [ $resultcode -eq 0 ]; then | |
| tiffcp $(ls -v | grep scan_) scan.tiff | |
| rm scan_* | |
| fi | |
| else | |
| scanimage --format=tiff --resolution $resolution >scan.tiff | |
| resultcode=$? | |
| fi | |
| if [ $resultcode -eq 0 ]; then | |
| convert scan.tiff scan.pdf | |
| rm scan.tiff | |
| mv scan.pdf /opt/paperless/consume/scan_$(date +'%d_%m_%y_%H_%M_%S').pdf | |
| fi | |
| exit $resultcode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment