WinANT Help

 

Installing Batik and the Rasterizer Task

This topic describes how to install Apache Batik and the Rasterizer Ant Task on a Windows PC, so that its SVG processing functionality can be used by some DITA Open Toolkit plug-ins, notably the DITA Plus plug-in.

You must have Java SDK 1.4 or above installed for Batik to function. Batik version 1.7 or above is required by the DITA Plus plug-in.

Batik is a set of open source tools developed by the Apache Foundation for SVG processing. SVG (Scaleable Vector Graphic) is an XML format for vector graphics. The Batik tools include an SVG browser (Squiggle) and an SVG rasterizer which converts SVG files to raster graphic formats such as JPG and PNG.

DITA topics can contain SVG graphics. However, the standard transformations in the DITA Open Toolkit cannot convert these files to browser-compatible raster graphic formats. The FO plug-in to the toolkit (PDF2 transformation type) can render SVG graphics in a PDF output. This FO plug-in uses its the SVG rasterizer build into RenderX XEP. The DITA Plus plug-in, developed by Deborah Pickett, adds SVG processing to the HTML-based DITA OT transformations, but requires Batik, along with a Batik Ant Rasterizer task, to be installed to handle the SVG conversion.

  1. Download the Batik 1.7 source distribution (for Java 1.4 and above) to a temporary location on your computer. The download is a single ZIP file.
  2. Unzip the downloaded file to a temporary folder, keeping the folder structure of the files in the zip file.
  3. Open a Command Prompt window (Start > All Programs > Accessories > Command Prompt.
  4. Change directory to the Batik root folder within the temporary directory (ie, the folder where you unzipped the download file). For example, cd c:\temp\batik_1.7.
  5. Enter .\build.bat jars, and press Enter. The build process will execute to create the Batik Java archive (jar) files in a folder prefixed with batik in the Batik temporary folder.
  6. Change directory to the contrib\rasterizertask folder within the Batik temporary folder. For example, cd c:\temp\batik_1.7\contrib\rasterizertask.
  7. Enter .\build.bat jar, and press Enter. The build process will execute to create the RasterizerTask Java archive (jar) files in a folder prefixed with batik in the build\lib sub-folder of the rasterizertask folder.
  8. Copy the jar files generated by the two build processes into a batik sub-folder of the DITA Open Toolkit directory. For example, into c:\dita-ot\batik. You should have the following files in the batik sub-folder:
    • batik.jar
    • batik-rasterizer.jar
    • batik-slideshow.jar
    • batik-squiggle.jar
    • batik-svgpp.jar
    • batik-ttf2svg.jar
    • RasterizerTask.jar
  9. Add the batik sub-folder to the CLASSPATH.
The necessary Batik components for the DITA Plus plug-in, and any other plug-ins to the DITA Open Toolkit requiring rasterizing of SVG graphics using Batik, are now installed and ready for use. The components can produce four raster formats: PNG, JPEG, TIFF and PDF.
Related information
Batik SVG Rasterizer Tool