Root/
| 1 | #!/bin/bash |
| 2 | # |
| 3 | # fpd2pdf - Print a set of Fped files into a PDF |
| 4 | # |
| 5 | # Written 2010-2011 by Werner Almesberger |
| 6 | # Copyright 2010-2011 Werner Almesberger |
| 7 | # |
| 8 | # This program is free software; you can redistribute it and/or modify |
| 9 | # it under the terms of the GNU General Public License as published by |
| 10 | # the Free Software Foundation; either version 2 of the License, or |
| 11 | # (at your option) any later version. |
| 12 | # |
| 13 | |
| 14 | |
| 15 | usage() |
| 16 | { |
| 17 | cat <<EOF 1>&2 |
| 18 | usage: $0 [-a] [-o out.pdf] [-P] file.fpd[:package] ... |
| 19 | |
| 20 | -a also include files whose name contains a tilde (backup files) |
| 21 | -o out.pdf write to the specified file (default: standard output) |
| 22 | -P use full page drawings |
| 23 | EOF |
| 24 | exit 1 |
| 25 | } |
| 26 | |
| 27 | |
| 28 | out=- |
| 29 | all=false |
| 30 | p_opt=-p |
| 31 | |
| 32 | while true; do |
| 33 | case "$1" in |
| 34 | -a) all=true |
| 35 | shift;; |
| 36 | -o) [ -z "$2" ] && usage |
| 37 | out="$2" |
| 38 | shift 2;; |
| 39 | -P) p_opt=-P |
| 40 | shift;; |
| 41 | -*) usage;; |
| 42 | *) break;; |
| 43 | esac |
| 44 | done |
| 45 | |
| 46 | [ -z "$1" ] && usage |
| 47 | |
| 48 | eval gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$out -f \ |
| 49 | `for n in "$@"; do $all || [ "$n" = "${n/\~/}" ] && \ |
| 50 | echo "<(fped $p_opt \ |
| 51 | \"\`echo \\"$n\\" | sed 's/:.*//'\`\" \ |
| 52 | \`echo \"$n\" | sed 's/.*:/-1/p;d'\` \ |
| 53 | -)"; done` |
| 54 |
Branches:
master
