mirror of
https://github.com/rocketraman/sane-scan-pdf.git
synced 2025-06-02 07:20:17 -07:00
Cleanup and document defaults and pre-scan hook
This commit is contained in:
parent
c774b8eeca
commit
5bb8cd9ea1
16
README.md
16
README.md
@ -88,10 +88,24 @@ OUTPUT
|
|||||||
-l, --outputlist <outputfile-1...outputfile-n> Output to named files for each scanned page, can be used with append
|
-l, --outputlist <outputfile-1...outputfile-n> Output to named files for each scanned page, can be used with append
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
Use `--help` locally to show the location of optional configuration and
|
||||||
|
pre-scan hook scripts. These scripts may contain environment variables to
|
||||||
|
pre-configure `scan`. For example the contents of the `default` file may be
|
||||||
|
something like:
|
||||||
|
|
||||||
|
```
|
||||||
|
DEVICE=something
|
||||||
|
SEARCHABLE=1
|
||||||
|
MODE_HW_DEFAULT=1
|
||||||
|
```
|
||||||
|
|
||||||
### Tips
|
### Tips
|
||||||
|
|
||||||
The default scanner device is set to `fujitsu`. If you have another scanner,
|
The default scanner device is set to `fujitsu`. If you have another scanner,
|
||||||
you will need to use the `-x`/`--device` argument to specify your scanner.
|
you will need to use the `-x`/`--device` argument to specify your scanner,
|
||||||
|
or save a `DEVICE=something` line to a local config file as shown above.
|
||||||
See below for how to get the list of available devices.
|
See below for how to get the list of available devices.
|
||||||
|
|
||||||
The scanners and scanner drivers vary in features they support. This script
|
The scanners and scanner drivers vary in features they support. This script
|
||||||
|
13
scan
13
scan
@ -40,7 +40,9 @@ cleanup()
|
|||||||
}
|
}
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
[ -e "${XDG_DATA_HOME:-$HOME/.local/share}/sane-scan-pdf/defaults" ] && . "${XDG_DATA_HOME:-$HOME/.local/share}/sane-scan-pdf/defaults"
|
DEFAULTS="${XDG_DATA_HOME:-$HOME/.local/share}/sane-scan-pdf/defaults"
|
||||||
|
SCANPRE="${XDG_DATA_HOME:-$HOME/.local/share}/sane-scan-pdf/scan_pre"
|
||||||
|
[ -e "$DEFAULTS" ] && . "$DEFAULTS"
|
||||||
|
|
||||||
# Parse command-line options
|
# Parse command-line options
|
||||||
while [[ $# > 0 ]]; do
|
while [[ $# > 0 ]]; do
|
||||||
@ -149,6 +151,13 @@ if [[ $HELP == 1 ]]; then
|
|||||||
echo " Output to named file default=scan.pdf"
|
echo " Output to named file default=scan.pdf"
|
||||||
echo " -l, --outputlist <outputfile-1...outputfile-n> Output to named files for each scanned page, can be used with append"
|
echo " -l, --outputlist <outputfile-1...outputfile-n> Output to named files for each scanned page, can be used with append"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "CONFIGURATION"
|
||||||
|
echo "Local configuration can be written in the form of environment variables to:"
|
||||||
|
echo " $DEFAULTS"
|
||||||
|
echo ""
|
||||||
|
echo "A pre-scan hook script can be written to:"
|
||||||
|
echo " $SCANPRE"
|
||||||
|
echo ""
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -272,7 +281,7 @@ if [[ $MODE_HW_DEFAULT == 1 ]]; then
|
|||||||
else
|
else
|
||||||
MODE="--mode '$MODE'"
|
MODE="--mode '$MODE'"
|
||||||
fi
|
fi
|
||||||
[ -e "${XDG_DATA_HOME:-$HOME/.local/share}/sane-scan-pdf/scan_pre" ] && . "${XDG_DATA_HOME:-$HOME/.local/share}/sane-scan-pdf/scan_pre"
|
[ -e "$SCANPRE" ] && . "$SCANPRE"
|
||||||
eval scanadf -d \'"$DEVICE"\' $MAXPAGE $PGHEIGHT $PGWIDTH -S $SCRIPT --script-wait $DESKEW $CROP $DRIVER_OPTION $SOURCE --resolution $RESOLUTION $MODE -o $TMP_DIR/scan-%04d
|
eval scanadf -d \'"$DEVICE"\' $MAXPAGE $PGHEIGHT $PGWIDTH -S $SCRIPT --script-wait $DESKEW $CROP $DRIVER_OPTION $SOURCE --resolution $RESOLUTION $MODE -o $TMP_DIR/scan-%04d
|
||||||
# Simulate empty page scanner outputs for debugging
|
# Simulate empty page scanner outputs for debugging
|
||||||
#convert xc:none -page Letter $TMP_DIR/scan-0001.pdf
|
#convert xc:none -page Letter $TMP_DIR/scan-0001.pdf
|
||||||
|
Loading…
x
Reference in New Issue
Block a user