1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
FOP: An Open-Source XSL Formatter and Renderer
1) What is FOP?
2) Compiling FOP
3) Running FOP
4) What's Implemented?
5) Bugs
6) FOP Relevant Specifications
1) What is FOP?
FOP is the world's first print formatter driven by XSL formatting
objects. It is a Java 1.1 application that reads a formatting object
tree and then turns it into a PDF document. The formatting object
tree, can be in the form of an XML document (output by an XSLT engine
like XT or Xalan) or can be passed in memory as a DOM Document or (in
the case of XT) SAX events.
FOP is part of Apache's XML project. The homepage of FOP is
http:/xml.apache.org/fop (http:/xml.apache.org/fop)
.
2) Compiling FOP
1. Prerequisites
a) Java 1.1.x or later
b) XT from James Clark
Some of the Java source code in FOP is generated from XML using
XSLT. XT must be used to generate this code.
XT is an XSL stylesheet processor written in java. At the moment you
can't use any other processor, because the make file makes use of some
proprietary features of Clark's xt which allow to write output in more
then one document. You can find XT at
James Clark's website (http://www.jclark.com/xml/xt.html)
. You have to use XT version 19991105 or later.
(Under windows you shouldn't use the prepackaged xt.exe but also the
generic jar file, otherwise make won't work)
XT relies on an sax parser like XP (also J. Clark), which can be
downloaded at James
Clark's Website (http://www.jclark.com/xml/xp/index.html)
c) make
Under windows it has been reported that the use of the cygnus solutions port
of the GNU utilities works. You can find it at
Cygnus Solutions (http://sourceware.cygnus.com/cygwin/)
3) Running FOP
1) Prerequisites
Following software must be installed:
a) Java 1.1.x or later
b) A sax parser like XP (http://www.jclark.com/xml/xp/index.html)
.
c) If you have to produce the flow objects files, which are the input for FOP,
you need a transformation utility to create this files from your xml files.
Normally this is an XSLT stylesheet processor like
XT (http://www.jclark.com/xml/xt.html)
or XALAN (http://xml.apache.org/xalan/index.html)
.
2) Starting FOP as an standalone application
There are two ways of running FOP from the command line.
a) Method One
One is to first use an XSLT engine to produce the formatting object tree as an
XML document and then running the class org.apache.fop.apps.CommandLine with the
formatting object file name and PDF filename as arguments. You will need to include
FOP, SAX and your SAX Parser in your classpath and so you might invoke
java -cp fop_x_xx_x.jar;sax.jar;xp.jar
org.apache.fop.apps.CommandLine formatting-tree-file pdf-file
If your SAX Parser is other than XP, you will need to set the property
org.xml.sax.parser to the SAX Parser class to use.
b) Method Two
Rather than performing transformation with an XSLT before invoking FOP, it is
possible, if you use XT as your XSLT engine, to just call FOP and have it call
XT for you. To do this, run the class org.apache.fop.apps.CommandLine with the
source XML file name, XSL file name and PDF file name as arguments. You will
need to include FOP, SAX, your SAX Parser and XT in your classpath and so you might
invoke
java -cp fop_x_xx_x.jar;sax.jar;xp.jar;xt.jar
org.apache.fop.apps.CommandLine xml-file xsl-file pdf-file
Again, if your SAX Parser is other than XP, you will need to set the property
org.xml.sax.parser to the SAX Parser class to use.
Note: If you are using java 2 or later (i.e. jdk 1.2. or later) you can put all
needed jar files into the subdirectory jdk1.2.x\jre\lib\ext (windows example). Then
FOP can be started without classpath:
java org.apache.fop.apps.CommandLine formatting-tree-file pdf-file
4) What's Implemented?
Also see STATUS for what is being worked on.
a) Formatting Objects
root
layout-master-set
simple-page-master
region-body
region-before
region-after
page-sequence
sequence-specification
sequence-specifier-single
sequence-specifier-repeating
sequence-specifier-alternating
flow
static-content
block
list-block
list-item
list-item-label
list-item-body
page-number
display-sequence
inline-sequence
display-rule
display-graphic
table (minimal support)
table-column (minimal support)
table-body (minimal support)
table-row (minimal support)
table-cell (minimal support)
b) Properties
end-indent
page-master-name
page-master-first
page-master-repeating
page-master-odd
page-master-even
margin-top (only on pages and regions)
margin-bottom (only on pages and regions)
margin-left (only on pages and regions)
margin-right (only on pages and regions)
extent
page-width
page-height
flow-name
font-family
font-style
font-weight
font-size
line-height
text-align
text-align-last
space-before.optimum
space-after.optimum
start-indent
end-indent
provisional-distance-between-starts
provisional-label-separation
rule-thickness
color
wrap-option
white-space-treatment
break-before
break-after
text-indent
href
column-width
5) Bugs
see STATUS file
6) FOP Relevant Specifications
XML Recommendation (http://www.w3.org/TR/REC-xml)
XSL-FO Working Draft (http://www.w3.org/TR/WD-xsl/)
XSLT Recommandation (http://www.w3.org/TR/xslt)
PDF Documentation (http://partners.adobe.com/asn/developer/acrosdk/DOCS/pdfspec.pdf)
Simple API for XML (SAX) (http://www.megginson.com/SAX/)
Document Object Model (DOM) (http://www.w3.org/TR/REC-DOM-Level-1)
Namespaces in XML Recommendation (http://www.w3.org/TR/REC-xml-names/)
Java JDK 1.1 Documentation (http://java.sun.com/products/jdk/1.1/docs/index.html)
Version: 1.3 1999/11/23 03:31:30 -
Contact: James Tauber (jtauber@jtauber.com)
|