"Fossies" - the Fresh Open Source Software Archive 
Member "usr/share/Ted/examples/rtf2ps.sh" (1 Feb 2013, 2090 Bytes) of package /linux/misc/old/ted-2.23-linux-amd64.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #!/bin/sh
2
3 ########################################################################
4 #
5 # Convert an rtf document to PostScript format using 'Ted'.
6 #
7 # Usage rtf2ps.sh --paper paper something.rtf something.ps
8 # Or rtf2ps.sh something.rtf something.ps
9 #
10 # Valid values for paper are a4, a5, a6, letter, legal and executive
11 #
12 # This is an example. Refer to http://www.nllgg.nl/Ted/index.html for the
13 # 'Ted' documentation.
14 #
15 # If you want 'Ted' to set configurable resources, use
16 # Ted --printToFilePaper --setProperty ... in the Ted way. E.G:
17 # Ted --setProperty usePostScriptFilters 1 \
18 # --setProperty usePostScriptIndexedImages 1 \
19 # --setProperty afmDirectory /usr/share/ghostscript/fonts \
20 # --setProperty fontDirectory /usr/share/ghostscript/fonts \
21 # --setProperty ghostscriptFontmap \
22 # /usr/share/ghostscript/6.53/lib/Fontmap \
23 # --setProperty ghostscriptFontToXmapping \
24 # /usr/share/ghostscript/6.53/lib/fonts.dir \
25 # --printToFilePaper .....
26 # The settings can also be stored in /usr/share/Ted/Ted.properties or in
27 # $(HOME)/.Ted.properties files. Refer to the Ted documentation for
28 # more details.
29 #
30 # This script uses the --printToFile invocation rather than the --saveTo
31 # invocation to use an explicit paper size or the default one of the machine.
32 # Ted --saveTo this.rtf that.ps produces a PostScript file with the paper size
33 # of the rtf input document.
34 #
35 ########################################################################
36
37 PAPER=
38
39 case $# in
40 1|2)
41 ;;
42 3|4)
43 case $1 in
44 --paper)
45 ;;
46 *)
47 echo $0: '$1='$1 'Expected --paper'
48 exit 1
49 ;;
50 esac
51
52 case $2 in
53 a4|a5|a6|letter|legal|executive)
54 PAPER=$2
55 ;;
56 *)
57 echo $0: '$2='$2 'Expected a4|a5|a6|letter|legal|executive'
58 exit 1
59 ;;
60 esac
61 shift; shift;
62 ;;
63 *)
64 echo $0: '$#='$#
65 exit 1
66 ;;
67 esac
68
69 case $# in
70 1)
71 rtf="$1";
72 ps=`basename "$1" .rtf`.ps
73 ;;
74 2)
75 rtf="$1";
76 ps="$2";
77 ;;
78 *)
79 echo $0: '$#='$#
80 exit 1
81 ;;
82 esac
83
84 case $PAPER in
85 ?*)
86 Ted --printToFilePaper "$rtf" "$ps" $PAPER
87 ;;
88 *)
89 Ted --printToFile "$rtf" "$ps"
90 ;;
91 esac
92