2010-08-28 05:29:13 +03:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# fpd2pdf - Print a set of Fped files into a PDF
|
|
|
|
#
|
|
|
|
# Written 2010 by Werner Almesberger
|
|
|
|
# Copyright 2010 Werner Almesberger
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
2010-08-29 04:58:04 +03:00
|
|
|
cat <<EOF 1>&2
|
|
|
|
usage: $0 [-a] [-o out.pdf] file.pdf ...
|
|
|
|
|
|
|
|
-a also include files whose name contains a tilde (backup files)
|
|
|
|
-o out.pdf write to the specified file (default: standard output)
|
|
|
|
EOF
|
2010-08-28 05:29:13 +03:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
out=-
|
2010-08-29 04:58:04 +03:00
|
|
|
all=false
|
|
|
|
|
2010-08-28 05:29:13 +03:00
|
|
|
while true; do
|
|
|
|
case "$1" in
|
2010-08-29 04:58:04 +03:00
|
|
|
-a) all=true
|
|
|
|
shift;;
|
2010-08-28 05:29:13 +03:00
|
|
|
-o) [ -z "$2" ] && usage
|
|
|
|
out="$2"
|
|
|
|
shift 2;;
|
|
|
|
-*) usage;;
|
|
|
|
*) break;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
[ -z "$1" ] && usage
|
|
|
|
|
|
|
|
eval gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$out -f \
|
2010-08-29 04:58:04 +03:00
|
|
|
`for n in "$@"; do $all || [ "$n" = "${n/\~/}" ] && \
|
|
|
|
echo "<(fped -p \"$n\" -)"; done`
|