2010-11-13 23:50:22 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# fpd2pdf - Print a set of Fped files into a PDF
|
|
|
|
#
|
2011-02-07 01:04:05 +02:00
|
|
|
# Written 2010-2011 by Werner Almesberger
|
|
|
|
# Copyright 2010-2011 Werner Almesberger
|
2010-11-13 23:50:22 +02:00
|
|
|
#
|
|
|
|
# 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()
|
|
|
|
{
|
|
|
|
cat <<EOF 1>&2
|
2011-02-07 01:04:05 +02:00
|
|
|
usage: $0 [-a] [-o out.pdf] [-P] file.fpd ...
|
2010-11-13 23:50:22 +02:00
|
|
|
|
|
|
|
-a also include files whose name contains a tilde (backup files)
|
|
|
|
-o out.pdf write to the specified file (default: standard output)
|
2011-02-07 01:04:05 +02:00
|
|
|
-P use full page drawings
|
2010-11-13 23:50:22 +02:00
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
out=-
|
|
|
|
all=false
|
2011-02-07 01:04:05 +02:00
|
|
|
p_opt=-p
|
2010-11-13 23:50:22 +02:00
|
|
|
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
|
|
|
-a) all=true
|
|
|
|
shift;;
|
|
|
|
-o) [ -z "$2" ] && usage
|
|
|
|
out="$2"
|
|
|
|
shift 2;;
|
2011-02-07 01:04:05 +02:00
|
|
|
-P) p_opt=-P
|
|
|
|
shift;;
|
2010-11-13 23:50:22 +02:00
|
|
|
-*) usage;;
|
|
|
|
*) break;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
[ -z "$1" ] && usage
|
|
|
|
|
|
|
|
eval gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$out -f \
|
|
|
|
`for n in "$@"; do $all || [ "$n" = "${n/\~/}" ] && \
|
2011-02-07 01:04:05 +02:00
|
|
|
echo "<(fped $p_opt \"$n\" -)"; done`
|