Table of contents

Abstract

A box of beautifully enticing promise

The extended analogy

The story on PDF files and fonts

Configuring the DITA Open Toolkit build file for FOP

Defining fonts in the FOP configuration file

XSL-FO stylesheets and FOP-registered fonts

Configuring the DITA Open Toolkit build file for FOP

FOP is bundled with the DITA Open Toolkit in the demo/fo/fop folder (in version 1.4.3 and later). Although there is a parameter in the Ant build files to reference the location of FOP’s user configuration file, the parameter is optional, and has no value by default. Configuration settings for FOP are stored in the fop.xconf file. FOP supplies a default fop.xconf file, but the DITA Open Toolkit does not reference it, and no configuration file is used by default. To address this, you must add a parameter that specifies the location of the FOP configuration file.

Here’s what you do:

  1. Verify the location of the FOP configuration file. In DITA Open Toolkit 1.4.3 and (so far) in DITA Open Toolkit 1.5, this is the path and filename:

    demo/fo/fop/conf/fop.xconf

    NOTE: In earlier versions of the OT, fop.xconf file is not included. It can be added. I would recommend a new, full installation of FOP for earlier versions of the DITA Open Toolkit, or use DITA Open Toolkit 1.4.3 if possible. Integration of a new install of FOP with the DITA Open Toolkit is beyond the scope of this document. You could add the fop.xconf file somewhere and continue to use the instructions in this document. The location of the fop.xconf file will be specified in the Ant build files as described later in step 4.

  2. In the DITA Open Toolkit’s root directory, open the build_dita2pdf.xml file in a text editor or an XML editor.
  3. At the top of the file, find these two lines (lines 7 and 8 in Open Toolkit 1.4.3):

    <project name="dita2pdf" default="dita2pdf">

    <property name="transtype" value="pdf"/>

  4. Add a new property after the two lines shown in step 3:

    <property name="args.fo.userconfig" value="${basedir}/demo/fo/fop/conf/fop.xconf"/>

    NOTE: You may have to adjust the path in the value attribute to match the path to your copy of fop.xconf. The parameter ${basedir} is the absolute path location of the DITA Open Toolkit you are using, so that’s where your path should start.

  5. Save and close the file. Now the Open Toolkit directs FOP to read your changes in the FOP configuration file. Changes to the FOP configuration file are described in the next section.
  6. To verify that the configuration file is now configured to work with the Open Toolkit, use the Open Toolkit to create PDF output from DITA source files. In the output messages from the build, you should find the entry for the dita.fo2pdf.userconfig Ant task. Following the line that says “dita.fo2pdf.userconfig” should be additional entries that begin with “[fop].” For example, the first few lines of my output for the dita.fo2pdf.userconfig task looked like this:

    dita.fo2pdf.userconfig:
    [fop] Oct 2, 2009 2:11:57 PM org.apache.fop.apps.FopFactoryConfigurator configure
    [fop] INFO: Default page-height set to: 11in
    [fop] Oct 2, 2009 2:11:57 PM org.apache.fop.apps.FopFactoryConfigurator configure
    [fop] INFO: Default page-width set to: 8.26in

 

Next Page:
Defining fonts in the FOP configuration file


Scriptorium Publishing | Post Office Box 12761 Research Triangle Park, NC 27709 | (919) 481 2701 | info@scriptorium.com