From 1a3636171f599e31d9964fbcf6e32cfc3e6fbbf3 Mon Sep 17 00:00:00 2001
From: fotis
driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
driver.setWriter(new PrintWriter(new FileWriter(args[1])));
driver.setOutputStream(new FileOutputStream(args[1]));
driver.buildFOTree(parser, fileInputSource(args[0]));
+You can find UML diagramms for all Fop packages (latest release version)
+
Please report bugs to the discussion list fop-dev@xml.apache.org and put - the word [BUG] in the subject line.
+Please report bugs to
Please make sure, before you report a bug, that it is not mentioned in the FAQ or - in the list of open bugs in the file STATUS in the start directory of the Fop - distribution.
-Please make your description as concise as possible and send an example fo + in the list of open bugs at bugzilla.
+Please make your description as concise as possible and add an example fo file with your report, which just demonstrates the problem. Thanks for your help!
A list of known bugs can be found at the end of the file
-
A list of known bugs can be found at
The build process relies on finding following libraries in your classpath (the version numbers indicate that building with them has been successfully tested, other, later versions may work too:
Instantiate org.apache.fop.apps.Driver. Once this class is instantiated, methods are called to set the Renderer to use, the (possibly multiple) ElementMapping(s) to - use and the PrintWriter to use to output the results of the + use and the OutputStream to use to output the results of the rendering (where applicable). In the case of the Renderer and ElementMapping(s), the Driver may be supplied either with the object itself, or the name of the class, in which case Driver will @@ -27,17 +27,26 @@
Once the FO Tree is built, the format() and render() methods may be called in that order.
-Here is an example use of Driver from CommandLine.java:
+Here is an example use of Driver:
Driver driver = new Driver();
driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer", version);
driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
driver.setWriter(new PrintWriter(new FileWriter(args[1])));
driver.setOutputStream(new FileOutputStream(args[1]));
driver.buildFOTree(parser, fileInputSource(args[0]));
driver.format();
driver.render();
Have a look at the classes CommandLine or XalanCommandLine for complete examples.
+In the directory xml-fop/docs/examples/embedding you can find a working example how to use + Fop in a servlet. You can drop the fop.war into the webapps directory of Tomcat, then + go to a URL like this: +
+http://localhost:8080/fop/fop?fo=/home/path/to/fofile.fo
+You can also find the source code there in the file FopServlet.java
Q: I can't find the source files for the formatting properties. The directories - where they should be are empty. Where can I find them?-
A: They are generated during the build process. So you should use the build script coming - with Fop at least once to generate these files. -
- -Q: Feature xxx of the XSL Working Draft 27 March 2000 does not work as it should. Why?-
A: First: Only a small subset of formatting objects and properties is - implemented at the moment. Please have a look at the section "Features", - which lists the supported fo and properties. Second: At the moment only - Working Draft 21 Apr 1999 is supported. -
- -Q: When will the latest version of the XSL working draft be supported?-
Basic conformance to the latest XSL working draft is scheduled for fall 2000. -
- -Q: Running FOP I get the following messages or something similar: - "WARNING: Unknown formatting object http://www.w3.org/XSL/Format/1.0^root" - and then a FATAL Error "Root element must be root, not default FO".- -
A: Make sure that you have specified as the namespace for fo the - following string: "http://www.w3.org/1999/XSL/Format". It is analogous - to the xslt namespace "http://www.w3.org/1999/XSL/Transform" -
- -Q: The char ">" is inserted into the page number display like this - "formatting FOs into areas [1] [2] [3>>>>]". Is this a bug?-
A: No, a feature. It simply means that on that page an area - overflowed (ie there was not enough room to fit the text in).
-Q: It looks like FOP must be honoring font properties when it shouldn't be? - Example: According to the dtd coming with the xsl-fo spec inline-sequence - shouldn't have any attributes, but FOP doesn't reject them. -- -
A: Font properties are inherited down to individual characters. You can
- specify font properties on any formatting object you like and any textual content
- will inherit those properties (unless overriden by a closer ancestor).
+ The Fop faq has an own site. Please look here:
+ The dtd coming with the xsl-fo spec isn't correct in this respect.
-
Q: I need some additional fonts in FOP. How I can set embedding fonts? -- -
A: At present, FOP does not support any fonts other than the built-in fonts - Times, Helvetica, Courier, Symbol and ZapfDingbats. -
- -FOP (building PDF files) normally supports only the base 14 font package defined in the Adobe PDF specification. That includes the following fonts: Helvetica, Times, Courier, Symbol and ZapfDingbats.
Font support in FOP can be extended by the addition of font metric files (written in XML) created from Adobe - Type 1 fonts. No other font types (TrueType, Type 0, Type 3, etc.) are supported at this time. The current method - of adding fonts to FOP requires the package to be recompiled. + Type 1 fonts and Truetype fonts. No other font types (Type 0, Type 3, etc.) are supported at this time. The current method + of adding fonts to FOP requires the package to be recompiled. You can also embed fonts into pdf files; see below.
As mentioned above you need an XML file containing font metrics to be able to use an additional font. FOP - contains a tool that can generate such a font metrics file from a PFM file. + contains a tool that can generate such a font metrics file from a PFM file, which normally comes with the font file.
Run the class org.apache.fop.fonts.apps.PFMReader to generate the XML file. Important: The tool does two @@ -91,4 +91,59 @@
Adding Truetype fonts is almost identical to the process of adding type 1 fonts. The main difference is in the first step.
+As mentioned above you need an XML file containing font metrics to be able to use an additional font. FOP + contains a tool that can generate such a font metrics file from your truetype font file +
+Create metrics for the fontfile (we assume the file has the name cmr10.ttf und to be in c:\myfonts\):
+java org.apache.fop.fonts.apps.TTFReader -fn TCM -cn TCM -ef C:\myfonts\cmr10.ttf C:\myfonts\cmr10.ttf ttfcm.xml
the -fn option sets the font name (in the example to TCM )
+the -cn option set the classname (in the example to CM)
+the -ef option will try to embed to font at the given path when fop is running (you can + change that in the generated xml file).
+Open the class org.apache.fop.render.pdf.FontSetup and add entries to the ones present according to + the following example: +
+
+ fontInfo.addMetrics("F14", new ZapfDingbats());
+
+ fontInfo.addMetrics("F19", new TCM()); //This is the new entry.
+
+ ...
+
+ fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", "normal");
+
+ fontInfo.addFontProperties("F19", "TCM", "normal", "normal"); //This is the new entry.
+
Note: The class name to use is visible in the <class-name> element of the font metrics file. +
+In the src/codegen directory you find the font metrics files for the base 14 fonts. The are being transformed + during build into Java classes and then compiled. The newly generated font metrics file must be included in this + process. To do that open build.xml and add entries according to the following example: +
+Look for the section "Initialization target" and add the following line at the end of it
+<property name="tcm.xml" value="${build.codegen}/tcm.xml">
then search for the section "Generate the source code". At the end of this section you can find + templates for type 1 and truetype fonts. use them with your font name:
+<xslt infile="${tcm.xml}" xsltfile="${ttffontfile.xsl}"
+ outfile="${build.src}/${replacestring}/render/pdf/fonts/TCM.java" smart="yes"/>
edit conf\userconfig.xml and add TCM to the list of embedded fonts
+Don't forget: If you have embedded fonts, you must run Fop with the flag -cuserconfig.xml, + otherwise the settings in userconfig.xml will not be read.
+Rebuild FOP!
+ +Not implemented: float, footnote, footnote-body
+Not implemented: float
Not implemented: wrapper, marker, retrieve-marker
+Not implemented: marker, retrieve-marker
At the moment Fop is mainly a tools to render XSL:FO files to pdf. Therefore if you want to contribute to Fop you should become +
At the moment Fop is mainly a tool to render XSL:FO files to pdf. Therefore if you want to contribute to Fop you should become
familiar with these standards. You can find their internet addresses on our
Only the property leader-length.optimum is used, so for all purposes you can use - "leader-length" instead. leader-length.minimum/maximum should be honored - for line-justification, but this does not happen. -
+leader-length.minimum is not used at all
</fo:table>
The latest version of Fop is 0.16 and it supports the xsl:fo candidate release. +
The latest version of Fop is 0.17 and it supports the xsl:fo candidate release.
You can
+
+
+
+
+
+
d) Optional: Fop supports the jimi library for image processing, if it is in your classpath
- when you build Fop. You can find it at
If you have problems running FOP, please have a look at the
-