-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmkpdf.sh
37 lines (32 loc) · 851 Bytes
/
mkpdf.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
# file: mkpdf.sh
# vim:fileencoding=utf-8:ft=sh
# Creates a PDF file from scanned images @ 150 DPI.
#
# Copyright © 2015-2016 R.F. Smith <[email protected]>.
# SPDX-License-Identifier: MIT
# Created: 2015-05-14 19:25:57 +0200
# Last modified: 2021-02-28T20:46:58+0100
set -e
RES=150 # Scanner resolution
PAGE=a4 # Page size
ID=$(basename $0)
# Check for arguments
if [ $# -lt 2 ]; then
echo "Usage: $ID outname file1 [file2 ...]"
exit 1
fi
OUTF=$1
shift 1
# Check for special programs that are used in this script.
PROGS="convert"
for P in $PROGS; do
which $P >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$(basename $0): The program \"$P\" cannot be found."
exit 1
fi
done
echo -n "Gathering pages in PDF file..."
convert "$@" -adjoin -page $PAGE -density $RES -units PixelsPerInch $OUTF
echo "done."