1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-23 00:42:28 +02:00
ben-wpan/scripts/schps2pdf
Werner Almesberger ab89a00f5c Generate a PDF with the all the current sheets.
- scripts/schhist2web: don't generate PDF for sheets that no longer exist
  at HEAD
- scripts/schhist2web: generate a PDF containing all sheets existing at
  HEAD
- scripts/schps2pdf: prefix was set to the wrong argument
- scripts/schps2pdf: removed left-over (and functionless) cat into gs
- scripts/schps2pdf: corrected quoting of the TOC entry
2010-08-30 04:13:20 -03:00

52 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
#
# schps2pdf - Generate PDF files from Eeschema Postscript
#
# 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()
{
cat <<EOF 1>&2
usage: $0 [options] [-o file.pdf] [file.ps ...]
-t prefix make a table of content. Remove prefix from file names.
EOF
exit 1
}
toc=false
out=-
while true; do
case "$1" in
-o) [ -z "$2" ] && usage
out=$2
shift 2;;
-t) [ -z "$2" ] && usage
toc=true
prefix="$2"
shift 2;;
-*)
usage;;
*)
break;;
esac
done
in=${1:--}
shift
eval gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=\""$out\"" -f \
`for n in "$in" "$@"; do \
echo "<(sheet=\`basename \"$n\" .ps\`;
$toc && echo '[ /Title ('\"\\${sheet#$prefix}\"') /OUT pdfmark';
cat \"$n\";)"; done`