1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-23 08:51:52 +02:00
ben-wpan/scripts/schps2pdf
Werner Almesberger 66cf6a296e We now generate and link delta PDFs with the state(s) of the sheet.
- scripts/schhist2web: keep latest version of a sheet's PDF in pdf_head
  instead of pdf_$head, so that we don't overwrite it later with a delta
- scripts/schhist2web: for each change, write an HTML file which loads
  the image and links to a delta PDF
- scripts/schps2pdf: new option -T to specify page titles
- scripts/Makefile (UPLOAD): also upload html_*
2010-08-30 06:05:57 -03:00

60 lines
1.3 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.
-T title make a table of content using the specified title. Each
sheet needs one -T option.
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;;
-T) [ -z "$2" ] && usage
toc=true
titles="$titles \"$2\""
shift 2;;
-*)
usage;;
*)
break;;
esac
done
in=${1:--}
shift
eval gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=\""$out\"" -f \
`export i=1; for n in "$in" "$@"; do \
i=\`expr $i + 1\`;
echo "<(sheet=\`basename \"$n\" .ps\`;
set x $titles; i=\`expr $i + 1\`; eval t='\\$$i';
$toc && echo '[ /Title ('\"\\${t:-\\${sheet#$prefix}}\"') /OUT pdfmark';
cat \"$n\";)"; done`