Interface Converter

All Known Implementing Classes:
Converter, Converter, ConverterBase, ConverterPalette, EPUBConverter, Html5Converter, Xhtml10Converter, Xhtml11Converter, XhtmlMathMLConverter

public interface Converter
This is an interface for a converter, which offers conversion of OpenDocument (or OpenOffice.org 1.x) documents into a specific format. Instances of this interface are created using the ConverterFactory
  • Method Details

    • getConfig

      Config getConfig()
      Get the interface for the configuration of this converter
      Returns:
      the configuration
    • setGraphicConverter

      void setGraphicConverter(GraphicConverter gc)
      Define a GraphicConverter implementation to use for conversion of graphic files. If no converter is specified, graphic files will not be converted into other formats.
      Parameters:
      gc - the GraphicConverter to use
    • readTemplate

      void readTemplate(InputStream is) throws IOException
      Read a template to use as a base for the converted document. The format of the template depends on the Converter implementation.
      Parameters:
      is - an InputStream from which to read the template
      Throws:
      IOException - if some exception occurs while reading the template
    • readTemplate

      void readTemplate(File file) throws IOException
      Read a template to use as a base for the converted document. The format of the template depends on the Converter implementation.
      Parameters:
      file - a file from which to read the template
      Throws:
      IOException - if the file does not exist or some exception occurs while reading the template
    • readStyleSheet

      void readStyleSheet(InputStream is) throws IOException
      Read a style sheet to include with the converted document. The format of the style sheet depends on the Converter implementation.
      Parameters:
      is - an InputStream from which to read the style sheet
      Throws:
      IOException - if some exception occurs while reading the style sheet
    • readStyleSheet

      void readStyleSheet(File file) throws IOException
      Read a style sheet to include with the converted document. The format of the style sheet depends on the Converter implementation.
      Parameters:
      file - a file from which to read the style sheet
      Throws:
      IOException - if the file does not exist or some exception occurs while reading the style sheet
    • readResource

      void readResource(InputStream is, String sFileName, String sMediaType) throws IOException
      Read a resource to include with the converted document. A resource can be any (binary) file and will be placed in the same directory as the style sheet
      Parameters:
      is - an InputStream from which to read the resource
      sFileName - the file name to use for the resource
      sMediaType - the media type of the resource, if null the media type will be guessed from the file name
      Throws:
      IOException - if some exception occurs while reading the resource
    • readResource

      void readResource(File file, String sFileName, String sMediaType) throws IOException
      Read a style sheet to include with the converted document. A resource can be any (binary) file and will be placed in the same directory as the style sheet
      Parameters:
      file - a file from which to read the style sheet
      sFileName - the file name to use for the resource
      sMediaType - the media type of the resource, if null the media type will be guessed from the file name
      Throws:
      IOException - if the file does not exist or some exception occurs while reading the resource
    • convert

      ConverterResult convert(InputStream is, String sTargetFileName) throws IOException
      Convert a document
      Parameters:
      is - an InputStream from which to read the source document.
      sTargetFileName - the file name to use for the converted document (if the converted document is a compound document consisting consisting of several files, this name will be used for the master document)
      Returns:
      a ConverterResult containing the converted document
      Throws:
      IOException - if some exception occurs while reading the document
    • convert

      ConverterResult convert(File source, String sTargetFileName) throws FileNotFoundException, IOException
      Convert a document
      Parameters:
      source - a File from which to read the source document.
      sTargetFileName - the file name to use for the converted document (if the converted document is a compound document consisting consisting of several files, this name will be used for the master document)
      Returns:
      a ConverterResult containing the converted document
      Throws:
      FileNotFoundException - if the file does not exist
      IOException - if some exception occurs while reading the document
    • convert

      ConverterResult convert(Document dom, String sTargetFileName, boolean bDestructive) throws IOException
      Convert a document
      Parameters:
      dom - a DOM tree representing the document as flat XML
      sTargetFileName - the file name to use for the converted document (if the converted document is a compound document consisting consisting of several files, this name will be used for the master document)
      bDestructive - set to true if the converter is allowed to remove contents from the DOM tree (to save memory)
      Returns:
      a ConverterResult containing the converted document
      Throws:
      IOException - if some exception occurs while reading the document