de.vc.jfo.tools

## Class Converter

- java.lang.Object
- - de.vc.jfo.tools.Converter

-     public class Converter
      extends java.lang.Object

  A converter reads a list of input files (RTF files) and transforms them into a certain output format.
  Usage:

  `Converter c = new Converter(OutputFormat.PDF);
  c.addInputFile( "c:/my-doc1.rtf" );
  c.addInputFile( "c:/test/my-doc2.rtf" );
  c.setOutputDir( "c:/pdfs" );
  c.run();
  `

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Converter(OutputFormat outputFormat)` Creates a new converter.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addConvertEventListener(ConverterEventListener l)`
    `void` | `addInputFile(java.io.File file)` Adds an input file to be converted.
    `void` | `addInputFile(java.io.File file, java.io.File output)` Adds an input file to be converted.
    `void` | `addInputFile(java.lang.String file)` Adds an input file to be converted.
    `void` | `addInputFile(java.lang.String file, java.lang.String output)` Adds an input file to be converted.
    `void` | `addInputFiles(java.io.File[] files)` Adds a set of input files to be converted.
    `protected java.io.File` | `createOutputFile(java.io.File inputFile)`
    `protected void` | `fireEvent(ConverterEvent evt)`
    `FontMapper` | `getFontMapper()` Gets the font-mapper for RTF to XSL-FO conversion.
    `java.io.File` | `getImageDir()` Gets the directory where images are stored.
    `java.io.File` | `getOutputDir()` Gets the directory where converted files are stored.
    `OutputFormat` | `getOutputFormat()` Gets the output format.
    `Renderer` | `getRenderer()` Gets the used renderer.
    `boolean` | `isAutoCompatibilityMode()`
    `boolean` | `isRecognizeXmlDirectives()`
    `void` | `removeAllInputFiles()` Removes all input files.
    `void` | `removeConvertEventListener(ConverterEventListener l)`
    `void` | `removeInputFile(java.io.File file)` Removes an input file.
    `void` | `removeInputFile(java.lang.String file)` Removes an input file.
    `void` | `removeInputFiles(java.io.File[] files)` Removes a set of input files.
    `void` | `run()` Starts converting all input files.
    `void` | `setAutoCompatibilityMode(boolean autoCompatibilityMode)`
    `void` | `setFontMapper(FontMapper fontMapper)` Sets the font-mapper for RTF to XSL-FO conversion.
    `void` | `setImageDir(java.io.File imageDir)` Sets the directory where images are stored.
    `void` | `setOutputDir(java.io.File outputDir)` Sets the directory where converted files are stored.
    `void` | `setOutputFormat(OutputFormat outputFormat)` Sets the output format.
    `void` | `setRecognizeXmlDirectives(boolean recognizeXmlDirectives)`
    `void` | `setRenderer(Renderer renderer)` Sets the renderer.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Converter

          public Converter(OutputFormat outputFormat)

      Creates a new converter.
      Parameters:
        `outputFormat` - Output format. You may specify a renderer for some output formats.

  - ### Method Detail

    - #### addInputFile

          public void addInputFile(java.io.File file)

      Adds an input file to be converted.
      Parameters:
        `file` - Input file (RTF).

    - #### addInputFile

          public void addInputFile(java.io.File file,
                          java.io.File output)

      Adds an input file to be converted.
      Parameters:
        `file` - Input file (RTF).

    - #### addInputFile

          public void addInputFile(java.lang.String file)

      Adds an input file to be converted.
      Parameters:
        `file` - Input file (RTF).

    - #### addInputFile

          public void addInputFile(java.lang.String file,
                          java.lang.String output)

      Adds an input file to be converted.
      Parameters:
        `file` - Input file (RTF).

    - #### addInputFiles

          public void addInputFiles(java.io.File[] files)

      Adds a set of input files to be converted.
      Parameters:
        `files` - Input files (RTF).

    - #### removeInputFile

          public void removeInputFile(java.io.File file)

      Removes an input file.
      Parameters:
        `file` - File

    - #### removeInputFile

          public void removeInputFile(java.lang.String file)

      Removes an input file.
      Parameters:
        `file` - File

    - #### removeInputFiles

          public void removeInputFiles(java.io.File[] files)

      Removes a set of input files.
      Parameters:
        `files` - Input files.

    - #### removeAllInputFiles

          public void removeAllInputFiles()

      Removes all input files.

    - #### run

          public void run()

      Starts converting all input files.

    - #### getImageDir

          public java.io.File getImageDir()

      Gets the directory where images are stored.
      Returns:
        Image directory.

    - #### getOutputDir

          public java.io.File getOutputDir()

      Gets the directory where converted files are stored.
      Returns:
        Output directory.

    - #### setOutputDir

          public void setOutputDir(java.io.File outputDir)

      Sets the directory where converted files are stored. A null value means that the output files are stored in the same folder of input files.
      Parameters:
        `outputDir` - Output directory.

    - #### setImageDir

          public void setImageDir(java.io.File imageDir)

      Sets the directory where images are stored.
      Parameters:
        `imageDir` - Image directory.

    - #### getOutputFormat

          public OutputFormat getOutputFormat()

      Gets the output format.
      Returns:
        Output format.

    - #### getRenderer

          public Renderer getRenderer()

      Gets the used renderer.
      Returns:
        Renderer.

    - #### setOutputFormat

          public void setOutputFormat(OutputFormat outputFormat)

      Sets the output format.
      Parameters:
        `outputFormat` - Output format.

    - #### setRenderer

          public void setRenderer(Renderer renderer)

      Sets the renderer. If render is NULL, the RendererFactory is asked for a renderer that supports output format.
      Parameters:
        `renderer` - Renderer.

    - #### getFontMapper

          public FontMapper getFontMapper()

      Gets the font-mapper for RTF to XSL-FO conversion.
      Returns:
        Font mapper.

    - #### isRecognizeXmlDirectives

          public boolean isRecognizeXmlDirectives()

    - #### isAutoCompatibilityMode

          public boolean isAutoCompatibilityMode()

    - #### setFontMapper

          public void setFontMapper(FontMapper fontMapper)

      Sets the font-mapper for RTF to XSL-FO conversion. If no font-mapper is specified the default font mapping (stored in jfo-config.xml) is used.
      Parameters:
        `fontMapper` - Font mapper.

    - #### setRecognizeXmlDirectives

          public void setRecognizeXmlDirectives(boolean recognizeXmlDirectives)

    - #### setAutoCompatibilityMode

          public void setAutoCompatibilityMode(boolean autoCompatibilityMode)

    - #### addConvertEventListener

          public void addConvertEventListener(ConverterEventListener l)

    - #### removeConvertEventListener

          public void removeConvertEventListener(ConverterEventListener l)

    - #### createOutputFile

          protected java.io.File createOutputFile(java.io.File inputFile)

    - #### fireEvent

          protected void fireEvent(ConverterEvent evt)

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.