Skip to content

Commit 00e9bea

Browse files
author
Fonic
committed
Release scan2pdf-v2.6
Changes: - Added option '-t/--prompt-timeout VALUE' (with VALUE in seconds); when specified, user prompts time out after the specified duration, allowing for automatic, time-based continuous scanning (useful for manual duplex and/or batch mode) - Added option '-i/--initial-prompt' which issues a user prompt before the first scan operation (e.g. before odd pages for manual duplex, before first document in batch mode) - Redistributed short options to free up letters for added features (mainly '-t' for '--prompt-TIMEOUT'; additionally, '-p' seemed more fitting for '--outfile-PATTERN') - Renamed option '-a/--batch-scan' to '-a/--batch-mode' (seemed more fitting) - Added defaults for all command line options to usage information (before, defaults for flags like manual duplex, batch mode, etc. were missing) - Added all possible configuration items to configuration file (before, flags like manual duplex, batch mode, etc. were omitted) - Applied several minor fixes (prints, comments, error messages)
1 parent d9a6cfb commit 00e9bea

5 files changed

Lines changed: 271 additions & 116 deletions

File tree

CHANGELOG.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
## Changelog for release v2.6
2+
3+
**Changes:**
4+
- Added option `-t/--prompt-timeout VALUE` (with `VALUE` in seconds); when
5+
specified, user prompts _time out_ after the specified duration, allowing
6+
for automatic, time-based continuous scanning (useful for manual duplex
7+
and/or batch mode)
8+
- Added option `-i/--initial-prompt` which issues a user prompt *before* the
9+
first scan operation (e.g. before odd pages for manual duplex, before first
10+
document in batch mode)
11+
- Redistributed short options to free up letters for added features (mainly
12+
`-t` for `--prompt-TIMEOUT`; additionally, `-p` seemed more fitting for
13+
`--outfile-PATTERN`)
14+
- Renamed option `-a/--batch-scan` to `-a/--batch-mode` (seemed more fitting)
15+
- Added defaults for *all* command line options to usage information (before,
16+
defaults for flags like manual duplex, batch mode, etc. were missing)
17+
- Added *all* possible configuration items to configuration file (before,
18+
flags like manual duplex, batch mode, etc. were omitted)
19+
- Applied several minor fixes (prints, comments, error messages)
20+
121
## Changelog for release v2.5
222

323
**Changes:**
@@ -75,4 +95,4 @@ Initial release (versions prior to v2.1 have not been published).
7595

7696
##
7797

78-
_Last updated: 01/23/24_
98+
_Last updated: 02/18/24_

README.md

Lines changed: 77 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -94,49 +94,55 @@ Available command line options:
9494
```
9595
Usage: scan2pdf.sh [OPTIONS] OUTFILE
9696
97-
Scan to PDF (scan2pdf) v2.5 (01/23/24)
97+
Scan to PDF (scan2pdf) v2.6 (02/18/24)
9898
Scan documents directly to PDF files.
9999
100100
Options:
101-
-d, --device STRING Scanner device ['brother3:net1;dev0']
102-
-m, --mode STRING Color mode ['24bit Color']
103-
'Black & White',
104-
'Gray[Error Diffusion]',
105-
'True Gray',
106-
'24bit Color',
107-
'24bit Color[Fast]'
108-
-r, --resolution VALUE Scan resolution in dpi [300]
109-
100, 150, 200, 300, 400, 600, 1200, 2400, 4800, 9600
110-
-s, --source STRING Scan source ['Automatic Document Feeder(left aligned)']
111-
'FlatBed',
112-
'Automatic Document Feeder(left aligned)',
113-
'Automatic Document Feeder(left aligned,Duplex)',
114-
'Automatic Document Feeder(centrally aligned)',
115-
'Automatic Document Feeder(centrally aligned,Duplex)'
116-
117-
-b, --brightness VALUE Brightness in percent (-50..50) [0]
118-
(only applied if supported by color mode)
119-
-c, --contrast VALUE Contrast in percent (-50..50) [0]
120-
(only applied if supported by color mode)
121-
122-
-l, --topleftx VALUE Top left x offset of scan area in mm (0..216) [0]
123-
-t, --toplefty VALUE Top left y offset of scan area in mm (0..356) [0]
124-
-x, --width VALUE Width of scan area in mm (0..216) [210]
125-
-y, --height VALUE Height of scan area in mm (0..356) [297]
126-
127-
-u, --manual-duplex Perform manual duplex scan: scan odd pages, prompt,
128-
scan even pages, then interleave odd and even pages
129-
to produce combined output
130-
131-
-a, --batch-scan Scan multiple documents, prompt in between documents
132-
(option '-o/--outfile-template' becomes mandatory)
133-
-o, --outfile-pattern Interpret OUTFILE argument as printf-style pattern,
134-
determine next available output file by incrementing
135-
integer component (e.g. '~/Documents/Scan_%05d.pdf')
136-
137-
-k, --keep-temp Keep temporary directory on exit
138-
139-
-h, --help Print usage information
101+
-d, --device STRING Scanner device ['brother3:net1;dev0']
102+
-m, --mode STRING Color mode ['24bit Color']
103+
'Black & White',
104+
'Gray[Error Diffusion]',
105+
'True Gray',
106+
'24bit Color',
107+
'24bit Color[Fast]'
108+
-r, --resolution VALUE Scan resolution in dpi [300]
109+
100, 150, 200, 300, 400, 600, 1200, 2400, 4800, 9600
110+
-s, --source STRING Scan source ['Automatic Document Feeder(left aligned)']
111+
'FlatBed',
112+
'Automatic Document Feeder(left aligned)',
113+
'Automatic Document Feeder(left aligned,Duplex)',
114+
'Automatic Document Feeder(centrally aligned)',
115+
'Automatic Document Feeder(centrally aligned,Duplex)'
116+
117+
-b, --brightness VALUE Brightness in percent (-50..50) [0]
118+
(only applied if supported by color mode)
119+
-c, --contrast VALUE Contrast in percent (-50..50) [0]
120+
(only applied if supported by color mode)
121+
122+
-x, --topleftx VALUE Top left x offset of scan area in mm (0..216) [0]
123+
-y, --toplefty VALUE Top left y offset of scan area in mm (0..356) [0]
124+
-w, --width VALUE Width of scan area in mm (0..216) [210]
125+
-e, --height VALUE Height of scan area in mm (0..356) [297]
126+
127+
-u, --manual-duplex Scan odd pages, prompt, scan even pages, interleave
128+
odd and even pages to produce combined output [no]
129+
130+
-a, --batch-mode Scan multiple documents, prompt in between documents
131+
(makes option '-p/--outfile-pattern' mandatory) [no]
132+
-p, --outfile-pattern Interpret OUTFILE argument as printf-style pattern,
133+
determine next output file by incrementing integer
134+
token (e.g. '~/Documents/Scan_%05d.pdf') [no]
135+
136+
-i, --initial-prompt Prompt before first scan operation (e.g. before odd
137+
pages for manual duplex or before first document in
138+
batch mode) [no]
139+
-t, --prompt-timeout VALUE Timeout for prompts in seconds (0 == no timeout) [0]
140+
Allows duplex- and/or batch-scanning without having
141+
to press ENTER to continue when being prompted
142+
143+
-k, --keep-temp Keep temporary directory on exit [no]
144+
145+
-h, --help Print usage information
140146
141147
NOTE:
142148
Strings/values in square brackets show current defaults.
@@ -154,7 +160,7 @@ Configuration options and current defaults:
154160
# Scan to PDF (scan2pdf) -
155161
# -
156162
# Created by Fonic <https://github.com/fonic> -
157-
# Date: 04/17/21 - 01/23/24 -
163+
# Date: 04/17/21 - 02/18/24 -
158164
# -
159165
# ------------------------------------------------------------------------------
160166

@@ -231,6 +237,7 @@ HEIGHT_DEFAULT=279 # Letter (279.4 mm /
231237

232238
# Options passed to 'scanimage' (array of strings)
233239
#SCANIMAGE_OPTS=("--progress" "--verbose") # Display scan progress, produce verbose output
240+
#SCANIMAGE_OPTS=("--progress" "--batch-prompt") # Display scan progress, prompt before each page
234241
SCANIMAGE_OPTS=("--progress") # Display scan progress
235242

236243
# Options passed to 'convert' (array of strings)
@@ -247,8 +254,36 @@ TIFFCP_OPTS=("-c" "lzw") # Use LZW compressio
247254
# NOTE: only used if 'convert' is not available
248255
#TIFF2PDF_OPTS=("-z") # Use ZIP compression (lossless, higher quality, larger PDF file)
249256
TIFF2PDF_OPTS=("-j" "-q" "95") # Use JPEG compression (quality 95) (lossy, lower quality, smaller PDF file)
257+
258+
# Manual duplex scan by default: scan odd pages, prompt, scan even
259+
# pages, interleave odd and even pages to produce combined output
260+
# (string, 'yes'/'no')
261+
MANUAL_DUPLEX_DEFAULT="no"
262+
263+
# Batch mode by default: scan multiple documents, prompt in between
264+
# documents (string, 'yes'/'no')
265+
BATCH_MODE_DEFAULT="no"
266+
267+
# Interpret OUTFILE command line argument as printf-style pattern by
268+
# default and determine next output file automatically by incrementing
269+
# integer token of pattern (string, 'yes'/'no')
270+
# Example:
271+
# Pattern '~/Documents/Scan_%05d.pdf' -> '~/Documents/Scan_00001.pdf',
272+
# '~/Documents/Scan_00002.pdf', '~/Documents/Scan_00003.pdf', ...
273+
OUTFILE_PATTERN_DEFAULT="no"
274+
275+
# Prompt before first scan operation by default (e.g. before odd pages
276+
# for manual duplex or before first document in batch mode) (string,
277+
# 'yes'/'no')
278+
INITIAL_PROMPT_DEFAULT="no"
279+
280+
# Default timeout for prompts (integer, in seconds; 0 == no timeout)
281+
PROMPT_TIMEOUT_DEFAULT=0
282+
283+
# Keep temporary directory on exit by default (string, 'yes'/'no')
284+
KEEP_TEMP_DEFAULT="no"
250285
```
251286

252287
##
253288

254-
_Last updated: 01/23/24_
289+
_Last updated: 02/18/24_

scan2pdf.conf

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Scan to PDF (scan2pdf) -
66
# -
77
# Created by Fonic <https://github.com/fonic> -
8-
# Date: 04/17/21 - 01/23/24 -
8+
# Date: 04/17/21 - 02/18/24 -
99
# -
1010
# ------------------------------------------------------------------------------
1111

@@ -82,6 +82,7 @@ HEIGHT_DEFAULT=279 # Letter (279.4 mm /
8282

8383
# Options passed to 'scanimage' (array of strings)
8484
#SCANIMAGE_OPTS=("--progress" "--verbose") # Display scan progress, produce verbose output
85+
#SCANIMAGE_OPTS=("--progress" "--batch-prompt") # Display scan progress, prompt before each page
8586
SCANIMAGE_OPTS=("--progress") # Display scan progress
8687

8788
# Options passed to 'convert' (array of strings)
@@ -98,3 +99,31 @@ TIFFCP_OPTS=("-c" "lzw") # Use LZW compressio
9899
# NOTE: only used if 'convert' is not available
99100
#TIFF2PDF_OPTS=("-z") # Use ZIP compression (lossless, higher quality, larger PDF file)
100101
TIFF2PDF_OPTS=("-j" "-q" "95") # Use JPEG compression (quality 95) (lossy, lower quality, smaller PDF file)
102+
103+
# Manual duplex scan by default: scan odd pages, prompt, scan even
104+
# pages, interleave odd and even pages to produce combined output
105+
# (string, 'yes'/'no')
106+
MANUAL_DUPLEX_DEFAULT="no"
107+
108+
# Batch mode by default: scan multiple documents, prompt in between
109+
# documents (string, 'yes'/'no')
110+
BATCH_MODE_DEFAULT="no"
111+
112+
# Interpret OUTFILE command line argument as printf-style pattern by
113+
# default and determine next output file automatically by incrementing
114+
# integer token of pattern (string, 'yes'/'no')
115+
# Example:
116+
# Pattern '~/Documents/Scan_%05d.pdf' -> '~/Documents/Scan_00001.pdf',
117+
# '~/Documents/Scan_00002.pdf', '~/Documents/Scan_00003.pdf', ...
118+
OUTFILE_PATTERN_DEFAULT="no"
119+
120+
# Prompt before first scan operation by default (e.g. before odd pages
121+
# for manual duplex or before first document in batch mode) (string,
122+
# 'yes'/'no')
123+
INITIAL_PROMPT_DEFAULT="no"
124+
125+
# Default timeout for prompts (integer, in seconds; 0 == no timeout)
126+
PROMPT_TIMEOUT_DEFAULT=0
127+
128+
# Keep temporary directory on exit by default (string, 'yes'/'no')
129+
KEEP_TEMP_DEFAULT="no"

scan2pdf.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Scan to PDF (scan2pdf) - Service Menu for KDE -
44
# -
55
# Created by Fonic <https://github.com/fonic> -
6-
# Date: 01/12/24 - 01/23/24 -
6+
# Date: 01/12/24 - 02/18/24 -
77
# -
88
# NOTE: -
99
# Copy/move this file to '~/.local/share/kio/servicemenus' and make -

0 commit comments

Comments
 (0)