Skip to content

Commit 4123c2e

Browse files
author
Fonic
committed
Release scan2pdf-v2.3
Changes: - Added option '-a/--batch-scan' to allow scanning multiple documents in one go, prompting user in between documents (depends on option '-o/--outfile-pattern' for output file naming) - Added option '-o/--outfile-pattern' that allows specifying OUTFILE command line argument as printf-style pattern (e.g. '~/Documents/Scan_%05d.pdf') that is used to automatically determine the next available output file name by incrementing the integer part of the pattern - Reordered configuration items to better highlight which settings to use for which paper size - Removed configuration items that only make sense to be modified via command line options from configuration file ('BATCH_SCAN_DEFAULT', 'OUTFILE_PATTERN_DEFAULT', 'KEEP_TEMP_DEFAULT') - Eliminated need to 'cd' to temporary directory by adding path to temporary directory to '--batch=' template of call to 'scanimage' - Added '--' to explicitely end option parsing to all external commands that support it - Applied a few minor tweaks to printed output (wording, spacing) - Extended headers in script and configuration file to 80 characters - Reformatted 'README.md' and 'CHANGELOG.md' to be more readable when viewed in a simple text viewer/editor
1 parent a3746f4 commit 4123c2e

4 files changed

Lines changed: 304 additions & 119 deletions

File tree

CHANGELOG.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,48 @@
1+
## Changelog for release v2.3
2+
3+
**Changes:**
4+
- Added option `-a/--batch-scan` to allow scanning multiple documents in one
5+
go, prompting user in between documents (depends on option
6+
`-o/--outfile-pattern` for output file naming)
7+
- Added option `-o/--outfile-pattern` that allows specifying OUTFILE command
8+
line argument as printf-style pattern (e.g. `~/Documents/Scan_%05d.pdf`)
9+
that is used to automatically determine the next available output file name
10+
by incrementing the integer part of the pattern
11+
- Reordered configuration items to better highlight which settings to use for
12+
which paper size
13+
- Removed configuration items that only make sense to be modified via command
14+
line options from configuration file (`BATCH_SCAN_DEFAULT`,
15+
`OUTFILE_PATTERN_DEFAULT`, `KEEP_TEMP_DEFAULT`)
16+
- Eliminated need to `cd` to temporary directory by adding path to temporary
17+
directory to `--batch=` template of call to `scanimage`
18+
- Added '--' to explicitely end option parsing to all external commands that
19+
support it
20+
- Applied a few minor tweaks to printed output (wording, spacing)
21+
- Extended headers in script and configuration file to 80 characters
22+
- Reformatted `README.md` and `CHANGELOG.md` to be more readable when viewed
23+
in a simple text viewer/editor
24+
25+
## Changelog for release v2.2
26+
27+
**Changes:**
28+
- Added support for using `convert` (ImageMagick) instead of `tiff2pdf`
29+
(LibTIFF) as the latter is no longer being built by default and will
30+
probably be removed completely from from LibTIFF in the foreseable future
31+
(see https://bugs.gentoo.org/914232)
32+
- Added empty lines within usage information group similar items (e.g.
33+
brightness + contrast, topleftx + toplefty + width + height, etc.)
34+
- If an output file is specified, abort if it already exists (instead of
35+
overwriting it)
36+
- If no output file is specified, automatically choose the next available
37+
`scan_NNNNN.pdf` file name (i.e. `scan_00001.pdf`, `scan_00002.pdf`, etc.)
38+
- Use `-e` for output file checks instead of `-f` (to catch non-file items
39+
like folders, fifos, sockets, etc. as well)
40+
141
## Changelog for release v2.1
242

343
Initial release (versions prior to v2.1 have not been published).
444

5-
Features:
45+
**Features:**
646
- Highly configurable (both via configuration file and command line options)
747
- Allows selecting scan source, scan resolution and color mode
848
- Allows setting brightness and contrast (for color modes that support this)
@@ -11,4 +51,4 @@ Features:
1151

1252
##
1353

14-
_Last updated: 09/16/23_
54+
_Last updated: 01/14/24_

README.md

Lines changed: 66 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,59 @@
11
# Scan to PDF (scan2pdf)
2-
Scan documents directly to PDF file from the command line. Especially useful to batch-scan large volumes.
2+
Scan documents directly to PDF files from the command line. Especially useful
3+
to batch-scan large volumes of documents.
34

45
## Donations
5-
I'm striving to become a full-time developer of [Free and open-source software (FOSS)](https://en.wikipedia.org/wiki/Free_and_open-source_software). Donations help me achieve that goal and are highly appreciated.
6+
I'm striving to become a full-time developer of [Free and open-source software
7+
(FOSS)](https://en.wikipedia.org/wiki/Free_and_open-source_software). Donations
8+
help me achieve that goal and are highly appreciated.
69

7-
<a href="https://www.buymeacoffee.com/fonic"><img src="https://raw.githubusercontent.com/fonic/donate-buttons/main/buymeacoffee-button.png" alt="Buy Me A Coffee" height="35"></a>&nbsp;&nbsp;&nbsp;<a href="https://paypal.me/fonicmaxxim"><img src="https://raw.githubusercontent.com/fonic/donate-buttons/main/paypal-button.png" alt="Donate via PayPal" height="35"></a>&nbsp;&nbsp;&nbsp;<a href="https://ko-fi.com/fonic"><img src="https://raw.githubusercontent.com/fonic/donate-buttons/main/kofi-button.png" alt="Donate via Ko-fi" height="35"></a>
10+
<a href="https://www.buymeacoffee.com/fonic"><img src="https://raw.githubusercontent.com/fonic/donate-buttons/main/buymeacoffee-button.png" alt="Buy Me A Coffee" height="35"></a>&nbsp;&nbsp;
11+
<a href="https://paypal.me/fonicmaxxim"><img src="https://raw.githubusercontent.com/fonic/donate-buttons/main/paypal-button.png" alt="Donate via PayPal" height="35"></a>&nbsp;&nbsp;
12+
<a href="https://ko-fi.com/fonic"><img src="https://raw.githubusercontent.com/fonic/donate-buttons/main/kofi-button.png" alt="Donate via Ko-fi" height="35"></a>
813

914
## Requirements
1015
**Dependencies:**<br/>
11-
_Bash (>=v4.0)_, _scanimage_ (part of [SANE](http://www.sane-project.org/)), _tiffcp_ and _tiff2pdf_ (part of [libtiff](http://libtiff.maptools.org/))
16+
_Bash (>=v4.0)_,
17+
_scanimage_ (part of [SANE](http://www.sane-project.org/)),
18+
_tiffcp_ (part of [LibTIFF](http://libtiff.maptools.org/)),
19+
_tiff2pdf_ (part of [LibTIFF](http://libtiff.maptools.org/))
20+
-or-
21+
_convert_ (part of [ImageMagick](https://www.imagemagick.org/))
1222

1323
**Packages:**<br/>
14-
Ubuntu: _bash_, _sane-utils_, _libtiff-tools_<br/>
15-
Gentoo: _app-shells/bash_, _media-gfx/sane-backends_, _media-libs/tiff_
24+
Ubuntu: _bash_, _sane-utils_, _libtiff-tools_, _imagemagick_<br/>
25+
Gentoo: _app-shells/bash_, _media-gfx/sane-backends_, _media-libs/tiff_,
26+
_media-gfx/imagemagick_
1627

1728
## Download & Installation
18-
Refer to the [releases](https://github.com/fonic/scan2pdf/releases) section for downloads links. There is no installation required. Simply extract the downloaded archive to a folder of your choice.
29+
Refer to the [releases](https://github.com/fonic/scan2pdf/releases) section
30+
for downloads links. There is no actual installation required. Simply extract
31+
the downloaded archive to a folder of your choice.
1932

2033
## Configuration
21-
Open `scan2pdf.conf` in your favorite text editor and adjust the settings to your liking. Refer to embedded comments for details. Refer to [this section](#configuration-options--defaults) for a listing of all configuration options and current defaults.
34+
Open `scan2pdf.conf` in your favorite text editor and adjust the settings
35+
to your liking. Refer to embedded comments for details. Refer to
36+
[this section](#configuration-options) for a listing of all configuration
37+
options and current defaults.
2238

23-
## Usage
24-
To scan a document to PDF file, use the following commands:
39+
## Quick Start
40+
To scan a single document to PDF file, use the following command:
2541
```
26-
$ cd scan2pdf-vX.Y
2742
$ ./scan2pdf.sh document.pdf
2843
```
2944

45+
To scan multiple documents to PDF files, use the following command:
46+
```
47+
$ ./scan2pdf.sh -a -o document_%05d.pdf
48+
```
49+
50+
## Command Line Options
51+
3052
Available command line options:
3153
```
3254
Usage: scan2pdf.sh [OPTIONS] OUTFILE
3355
34-
Scan to PDF (scan2pdf) v2.1 (09/16/23)
56+
Scan to PDF (scan2pdf) v2.3 (01/14/24)
3557
Scan documents directly to PDF file.
3658
3759
Options:
@@ -50,41 +72,51 @@ Options:
5072
'Automatic Document Feeder(left aligned,Duplex)',
5173
'Automatic Document Feeder(centrally aligned)',
5274
'Automatic Document Feeder(centrally aligned,Duplex)'
75+
5376
-b, --brightness VALUE Brightness in percent (-50..50) [0]
5477
(only applied if supported by color mode)
5578
-c, --contrast VALUE Contrast in percent (-50..50) [0]
5679
(only applied if supported by color mode)
80+
5781
-l, --topleftx VALUE Top left x offset of scan area in mm (0..216) [0]
5882
-t, --toplefty VALUE Top left y offset of scan area in mm (0..356) [0]
5983
-x, --width VALUE Width of scan area in mm (0..216) [216]
60-
-y, --height VALUE Height of scan area in mm (0..356) [280]
84+
-y, --height VALUE Height of scan area in mm (0..356) [279]
85+
86+
-a, --batch-scan Scan multiple documents, prompt in between documents
87+
(option '-o/--outfile-template' becomes mandatory)
88+
-o, --outfile-pattern Interpret OUTFILE argument as printf-style pattern,
89+
determine next available output file by incrementing
90+
integer component (e.g. '~/Documents/Scan_%05d.pdf')
91+
6192
-k, --keep-temp Keep temporary directory on exit
6293
-h, --help Print usage information
6394
6495
NOTE:
6596
Strings/values in square brackets show current defaults.
6697
```
6798

68-
## Configuration Options & Defaults
99+
## Configuration Options
69100

70101
Configuration options and current defaults:
71102
```sh
72103
# scan2pdf.conf
73104

74-
# -------------------------------------------------------------------------
75-
# -
76-
# Scan to PDF (scan2pdf) -
77-
# -
78-
# Created by Fonic <https://github.com/fonic> -
79-
# Date: 04/17/21 - 09/16/23 -
80-
# -
81-
# -------------------------------------------------------------------------
105+
# ------------------------------------------------------------------------------
106+
# -
107+
# Scan to PDF (scan2pdf) -
108+
# -
109+
# Created by Fonic <https://github.com/fonic> -
110+
# Date: 04/17/21 - 01/14/24 -
111+
# -
112+
# ------------------------------------------------------------------------------
82113

83114
# NOTE:
84115
# Turn scanner on and run 'scanimage --help' to get detailed information
85116
# on supported parameters and/or valid values for scan-related settings
86117

87118
# Default scanner device (string)
119+
#DEVICE_DEFAULT="brother3:net1;dev0"
88120
DEVICE_DEFAULT="brother4:net1;dev0"
89121

90122
# Supported color modes (array of strings), default color mode (string)
@@ -141,13 +173,14 @@ TOPLEFTY_MAX=356
141173
TOPLEFTY_DEFAULT=0
142174
WIDTH_MIN=0
143175
WIDTH_MAX=216
144-
#WIDTH_DEFAULT=210 # DIN A4 (210.0 mm / 8.3 in)
145-
WIDTH_DEFAULT=216 # Letter/Legal (215.9 mm / 8.5 in)
146176
HEIGHT_MIN=0
147177
HEIGHT_MAX=356
178+
#WIDTH_DEFAULT=210 # DIN A4 (210.0 mm / 8.3 in)
148179
#HEIGHT_DEFAULT=297 # DIN A4 (297.0 mm / 11.7 in)
149-
#HEIGHT_DEFAULT=356 # Legal (355.6 mm / 14.0 in)
150-
HEIGHT_DEFAULT=280 # Letter (279.4 mm / 11.0 in)
180+
#WIDTH_DEFAULT=216 # Legal (215.9 mm / 8.5 in)
181+
#HEIGHT_DEFAULT=356 # Legal (355.6 mm / 14.0 in)
182+
WIDTH_DEFAULT=216 # Letter (215.9 mm / 8.5 in)
183+
HEIGHT_DEFAULT=279 # Letter (279.4 mm / 11.0 in)
151184

152185
# Options passed to 'scanimage' (array of strings)
153186
#SCANIMAGE_OPTS=("--progress" "--verbose") # display scan progress, use verbose output
@@ -160,10 +193,14 @@ TIFFCP_OPTS=("-c" "lzw") # use LZW compression (fast)
160193
#TIFF2PDF_OPTS=("-z") # use ZIP compression (lossless, higher quality, bigger PDF file)
161194
TIFF2PDF_OPTS=("-j" "-q" "95") # use JPEG compression (quality 95) (lossy, lower quality, smaller PDF file)
162195

163-
# Keep temporary directory on exit by default (string, 'yes'/'no')
164-
KEEPTEMP_DEFAULT="no"
196+
# Options passed to 'convert' (array of strings)
197+
# NOTE:
198+
# 'convert' is only used if 'tiff2pdf' is not available
199+
# 'convert' uses separate options for INPUT and OUTPUT
200+
CONVERT_INPUT_OPTS=() # none
201+
CONVERT_OUTPUT_OPTS=() # none
165202
```
166203

167204
##
168205

169-
_Last updated: 09/16/23_
206+
_Last updated: 01/14/24_

scan2pdf.conf

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
# scan2pdf.conf
22

3-
# -------------------------------------------------------------------------
4-
# -
5-
# Scan to PDF (scan2pdf) -
6-
# -
7-
# Created by Fonic <https://github.com/fonic> -
8-
# Date: 04/17/21 - 09/16/23 -
9-
# -
10-
# -------------------------------------------------------------------------
3+
# ------------------------------------------------------------------------------
4+
# -
5+
# Scan to PDF (scan2pdf) -
6+
# -
7+
# Created by Fonic <https://github.com/fonic> -
8+
# Date: 04/17/21 - 01/14/24 -
9+
# -
10+
# ------------------------------------------------------------------------------
1111

1212
# NOTE:
1313
# Turn scanner on and run 'scanimage --help' to get detailed information
1414
# on supported parameters and/or valid values for scan-related settings
1515

1616
# Default scanner device (string)
17+
#DEVICE_DEFAULT="brother3:net1;dev0"
1718
DEVICE_DEFAULT="brother4:net1;dev0"
1819

1920
# Supported color modes (array of strings), default color mode (string)
@@ -70,13 +71,14 @@ TOPLEFTY_MAX=356
7071
TOPLEFTY_DEFAULT=0
7172
WIDTH_MIN=0
7273
WIDTH_MAX=216
73-
#WIDTH_DEFAULT=210 # DIN A4 (210.0 mm / 8.3 in)
74-
WIDTH_DEFAULT=216 # Letter/Legal (215.9 mm / 8.5 in)
7574
HEIGHT_MIN=0
7675
HEIGHT_MAX=356
76+
#WIDTH_DEFAULT=210 # DIN A4 (210.0 mm / 8.3 in)
7777
#HEIGHT_DEFAULT=297 # DIN A4 (297.0 mm / 11.7 in)
78-
#HEIGHT_DEFAULT=356 # Legal (355.6 mm / 14.0 in)
79-
HEIGHT_DEFAULT=280 # Letter (279.4 mm / 11.0 in)
78+
#WIDTH_DEFAULT=216 # Legal (215.9 mm / 8.5 in)
79+
#HEIGHT_DEFAULT=356 # Legal (355.6 mm / 14.0 in)
80+
WIDTH_DEFAULT=216 # Letter (215.9 mm / 8.5 in)
81+
HEIGHT_DEFAULT=279 # Letter (279.4 mm / 11.0 in)
8082

8183
# Options passed to 'scanimage' (array of strings)
8284
#SCANIMAGE_OPTS=("--progress" "--verbose") # display scan progress, use verbose output
@@ -89,5 +91,9 @@ TIFFCP_OPTS=("-c" "lzw") # use LZW compression (fast)
8991
#TIFF2PDF_OPTS=("-z") # use ZIP compression (lossless, higher quality, bigger PDF file)
9092
TIFF2PDF_OPTS=("-j" "-q" "95") # use JPEG compression (quality 95) (lossy, lower quality, smaller PDF file)
9193

92-
# Keep temporary directory on exit by default (string, 'yes'/'no')
93-
KEEPTEMP_DEFAULT="no"
94+
# Options passed to 'convert' (array of strings)
95+
# NOTE:
96+
# 'convert' is only used if 'tiff2pdf' is not available
97+
# 'convert' uses separate options for INPUT and OUTPUT
98+
CONVERT_INPUT_OPTS=() # none
99+
CONVERT_OUTPUT_OPTS=() # none

0 commit comments

Comments
 (0)