Skip to content

Commit

Permalink
Release scan2pdf-v2.3
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Fonic committed Jan 14, 2024
1 parent a3746f4 commit 4123c2e
Show file tree
Hide file tree
Showing 4 changed files with 304 additions and 119 deletions.
44 changes: 42 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,48 @@
## Changelog for release 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

## Changelog for release v2.2

**Changes:**
- Added support for using `convert` (ImageMagick) instead of `tiff2pdf`
(LibTIFF) as the latter is no longer being built by default and will
probably be removed completely from from LibTIFF in the foreseable future
(see https://bugs.gentoo.org/914232)
- Added empty lines within usage information group similar items (e.g.
brightness + contrast, topleftx + toplefty + width + height, etc.)
- If an output file is specified, abort if it already exists (instead of
overwriting it)
- If no output file is specified, automatically choose the next available
`scan_NNNNN.pdf` file name (i.e. `scan_00001.pdf`, `scan_00002.pdf`, etc.)
- Use `-e` for output file checks instead of `-f` (to catch non-file items
like folders, fifos, sockets, etc. as well)

## Changelog for release v2.1

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

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

##

_Last updated: 09/16/23_
_Last updated: 01/14/24_
95 changes: 66 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,59 @@
# Scan to PDF (scan2pdf)
Scan documents directly to PDF file from the command line. Especially useful to batch-scan large volumes.
Scan documents directly to PDF files from the command line. Especially useful
to batch-scan large volumes of documents.

## Donations
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.
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.

<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>
<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;
<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;
<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>

## Requirements
**Dependencies:**<br/>
_Bash (>=v4.0)_, _scanimage_ (part of [SANE](http://www.sane-project.org/)), _tiffcp_ and _tiff2pdf_ (part of [libtiff](http://libtiff.maptools.org/))
_Bash (>=v4.0)_,
_scanimage_ (part of [SANE](http://www.sane-project.org/)),
_tiffcp_ (part of [LibTIFF](http://libtiff.maptools.org/)),
_tiff2pdf_ (part of [LibTIFF](http://libtiff.maptools.org/))
-or-
_convert_ (part of [ImageMagick](https://www.imagemagick.org/))

**Packages:**<br/>
Ubuntu: _bash_, _sane-utils_, _libtiff-tools_<br/>
Gentoo: _app-shells/bash_, _media-gfx/sane-backends_, _media-libs/tiff_
Ubuntu: _bash_, _sane-utils_, _libtiff-tools_, _imagemagick_<br/>
Gentoo: _app-shells/bash_, _media-gfx/sane-backends_, _media-libs/tiff_,
_media-gfx/imagemagick_

## Download & Installation
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.
Refer to the [releases](https://github.com/fonic/scan2pdf/releases) section
for downloads links. There is no actual installation required. Simply extract
the downloaded archive to a folder of your choice.

## Configuration
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.
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) for a listing of all configuration
options and current defaults.

## Usage
To scan a document to PDF file, use the following commands:
## Quick Start
To scan a single document to PDF file, use the following command:
```
$ cd scan2pdf-vX.Y
$ ./scan2pdf.sh document.pdf
```

To scan multiple documents to PDF files, use the following command:
```
$ ./scan2pdf.sh -a -o document_%05d.pdf
```

## Command Line Options

Available command line options:
```
Usage: scan2pdf.sh [OPTIONS] OUTFILE
Scan to PDF (scan2pdf) v2.1 (09/16/23)
Scan to PDF (scan2pdf) v2.3 (01/14/24)
Scan documents directly to PDF file.
Options:
Expand All @@ -50,41 +72,51 @@ Options:
'Automatic Document Feeder(left aligned,Duplex)',
'Automatic Document Feeder(centrally aligned)',
'Automatic Document Feeder(centrally aligned,Duplex)'
-b, --brightness VALUE Brightness in percent (-50..50) [0]
(only applied if supported by color mode)
-c, --contrast VALUE Contrast in percent (-50..50) [0]
(only applied if supported by color mode)
-l, --topleftx VALUE Top left x offset of scan area in mm (0..216) [0]
-t, --toplefty VALUE Top left y offset of scan area in mm (0..356) [0]
-x, --width VALUE Width of scan area in mm (0..216) [216]
-y, --height VALUE Height of scan area in mm (0..356) [280]
-y, --height VALUE Height of scan area in mm (0..356) [279]
-a, --batch-scan Scan multiple documents, prompt in between documents
(option '-o/--outfile-template' becomes mandatory)
-o, --outfile-pattern Interpret OUTFILE argument as printf-style pattern,
determine next available output file by incrementing
integer component (e.g. '~/Documents/Scan_%05d.pdf')
-k, --keep-temp Keep temporary directory on exit
-h, --help Print usage information
NOTE:
Strings/values in square brackets show current defaults.
```

## Configuration Options & Defaults
## Configuration Options

Configuration options and current defaults:
```sh
# scan2pdf.conf

# -------------------------------------------------------------------------
# -
# Scan to PDF (scan2pdf) -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 04/17/21 - 09/16/23 -
# -
# -------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# -
# Scan to PDF (scan2pdf) -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 04/17/21 - 01/14/24 -
# -
# ------------------------------------------------------------------------------

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

# Default scanner device (string)
#DEVICE_DEFAULT="brother3:net1;dev0"
DEVICE_DEFAULT="brother4:net1;dev0"

# Supported color modes (array of strings), default color mode (string)
Expand Down Expand Up @@ -141,13 +173,14 @@ TOPLEFTY_MAX=356
TOPLEFTY_DEFAULT=0
WIDTH_MIN=0
WIDTH_MAX=216
#WIDTH_DEFAULT=210 # DIN A4 (210.0 mm / 8.3 in)
WIDTH_DEFAULT=216 # Letter/Legal (215.9 mm / 8.5 in)
HEIGHT_MIN=0
HEIGHT_MAX=356
#WIDTH_DEFAULT=210 # DIN A4 (210.0 mm / 8.3 in)
#HEIGHT_DEFAULT=297 # DIN A4 (297.0 mm / 11.7 in)
#HEIGHT_DEFAULT=356 # Legal (355.6 mm / 14.0 in)
HEIGHT_DEFAULT=280 # Letter (279.4 mm / 11.0 in)
#WIDTH_DEFAULT=216 # Legal (215.9 mm / 8.5 in)
#HEIGHT_DEFAULT=356 # Legal (355.6 mm / 14.0 in)
WIDTH_DEFAULT=216 # Letter (215.9 mm / 8.5 in)
HEIGHT_DEFAULT=279 # Letter (279.4 mm / 11.0 in)

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

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

##

_Last updated: 09/16/23_
_Last updated: 01/14/24_
34 changes: 20 additions & 14 deletions scan2pdf.conf
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# scan2pdf.conf

# -------------------------------------------------------------------------
# -
# Scan to PDF (scan2pdf) -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 04/17/21 - 09/16/23 -
# -
# -------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# -
# Scan to PDF (scan2pdf) -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 04/17/21 - 01/14/24 -
# -
# ------------------------------------------------------------------------------

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

# Default scanner device (string)
#DEVICE_DEFAULT="brother3:net1;dev0"
DEVICE_DEFAULT="brother4:net1;dev0"

# Supported color modes (array of strings), default color mode (string)
Expand Down Expand Up @@ -70,13 +71,14 @@ TOPLEFTY_MAX=356
TOPLEFTY_DEFAULT=0
WIDTH_MIN=0
WIDTH_MAX=216
#WIDTH_DEFAULT=210 # DIN A4 (210.0 mm / 8.3 in)
WIDTH_DEFAULT=216 # Letter/Legal (215.9 mm / 8.5 in)
HEIGHT_MIN=0
HEIGHT_MAX=356
#WIDTH_DEFAULT=210 # DIN A4 (210.0 mm / 8.3 in)
#HEIGHT_DEFAULT=297 # DIN A4 (297.0 mm / 11.7 in)
#HEIGHT_DEFAULT=356 # Legal (355.6 mm / 14.0 in)
HEIGHT_DEFAULT=280 # Letter (279.4 mm / 11.0 in)
#WIDTH_DEFAULT=216 # Legal (215.9 mm / 8.5 in)
#HEIGHT_DEFAULT=356 # Legal (355.6 mm / 14.0 in)
WIDTH_DEFAULT=216 # Letter (215.9 mm / 8.5 in)
HEIGHT_DEFAULT=279 # Letter (279.4 mm / 11.0 in)

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

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

0 comments on commit 4123c2e

Please sign in to comment.