Root/fpd2pdf/fpd2pdf

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
15usage()
16{
17    cat <<EOF 1>&2
18usage: $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
23EOF
24    exit 1
25}
26
27
28out=-
29all=false
30p_opt=-p
31
32while 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
44done
45
46[ -z "$1" ] && usage
47
48eval 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

Archive Download this file

Branches:
master



interactive