ru.novosoft.dc.rtf2fo
Class RTF2FO

java.lang.Object
  |
  +--ru.novosoft.dc.rtf2fo.RTF2FO

public class RTF2FO
extends java.lang.Object

The class contains a number of static service methods for convertion from RTF to FO.


Method Summary
static RTFDocument build(java.io.InputStream in, RTF2FOContext context, CommonLogger logger, PicturePool pool)
          Build an RTF document on the specified input stream, context, logger, and picture pool.
static org.w3c.dom.Document[] convert(java.io.InputStream in, RTF2FOContext context, CommonLogger logger, PicturePool pool, org.w3c.dom.DOMImplementation implementation)
          Convert an input stream to FO using the specified context, logger, and picture pool.
static org.w3c.dom.Document[] convert(RTFDocument document, RTF2FOContext context, CommonLogger logger, org.w3c.dom.DOMImplementation implementation)
          Convert the specified RTF document to FO using the specified context, logger, and picture pool.
static void convert(java.lang.String fileName, boolean indent)
          Convert the specified RTF file to FO using the default configuration settings.
static void convert(java.lang.String fileName, int logLevel, boolean indent)
          Convert the specified RTF file to FO using the default configuration settings and the specified logging level.
static boolean convert(java.lang.String fileName, RTF2FOContext context, boolean indent)
          Convert the specified RTF file to FO using the specified context and logging to the default logger of the context.
static boolean convert(java.lang.String source, java.lang.String target, RTF2FOContext context, CommonLogger logger, ConversionHandler handler, boolean indent)
          Convert the specified RTF file to FO using the specified context and logger.
static boolean convert(java.lang.String source, java.lang.String target, RTF2FOContext context, CommonLogger logger, ConversionHandler handler, PicturePool pool, boolean indent)
          Convert the specified RTF file to FO using the specified context, logger, and picture pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

convert

public static final void convert(java.lang.String fileName,
                                 boolean indent)
Convert the specified RTF file to FO using the default configuration settings. The results are stored together with the RTF file. The pictures are stored in the subdirectory having the ".images" extension. The normal logging level is used.
Parameters:
fileName - a name of the RTF file to be converted
indent - if true, the document(s) will be written in the indent mode

convert

public static final void convert(java.lang.String fileName,
                                 int logLevel,
                                 boolean indent)
Convert the specified RTF file to FO using the default configuration settings and the specified logging level. The results are stored together with the RTF file. The pictures are stored in the subdirectory having the ".images" extension.
Parameters:
fileName - a name of the RTF file to be converted
logLevel - a logging level
indent - if true, the document(s) will be written in the indent mode

convert

public static final boolean convert(java.lang.String fileName,
                                    RTF2FOContext context,
                                    boolean indent)
Convert the specified RTF file to FO using the specified context and logging to the default logger of the context. The results are stored together with the RTF file. The pictures are stored in the subdirectory having the ".images" extension.
Parameters:
fileName - a name of the RTF file to be converted
context - a context of RTF2FO
indent - if true, the document(s) will be written in the indent mode
Returns:
true, if conversion was successful, and false if conversion was cancelled by rtf-filter

convert

public static final boolean convert(java.lang.String source,
                                    java.lang.String target,
                                    RTF2FOContext context,
                                    CommonLogger logger,
                                    ConversionHandler handler,
                                    boolean indent)
Convert the specified RTF file to FO using the specified context and logger. The results are stored in files specified by the target path. The pictures are stored in the subdirectory having the ".images" extension respectively to the location of target path.
Parameters:
source - a name of the RTF file to be converted
target - a template path for resulting files (its extension is changed to appropriate once)
context - a context of RTF2FO
logger - a logger used for logging messaged
handler - a handler of document conversion
indent - if true, the document(s) will be written in the indent mode
Returns:
true, if conversion was successful, and false if conversion was cancelled by rtf-filter

convert

public static boolean convert(java.lang.String source,
                              java.lang.String target,
                              RTF2FOContext context,
                              CommonLogger logger,
                              ConversionHandler handler,
                              PicturePool pool,
                              boolean indent)
Convert the specified RTF file to FO using the specified context, logger, and picture pool. The results are stored in files specified by the target path. The following options must be defined in the context: "fo-file-extension", "fo-template-extension", and "fo-data-extension". The method also uses the "xml-line-width" option for specifying of the necessary line width for serialization of fo-file or fo-template. The fo-data are always serialized with indents and with unlimitted line width.
Parameters:
source - a name of the RTF file to be converted
target - a template name for resulting files (its extension is changed to appropriate once)
context - a context of RTF2FO
logger - a logger used for logging messaged
handler - a handler of document conversion
pool - a picture pool responsible for saving pictures
indent - if true, the document(s) will be written in the indent mode
Returns:
true, if conversion was successful, and false if conversion was cancelled by rtf-filter

convert

public static final org.w3c.dom.Document[] convert(java.io.InputStream in,
                                                   RTF2FOContext context,
                                                   CommonLogger logger,
                                                   PicturePool pool,
                                                   org.w3c.dom.DOMImplementation implementation)
Convert an input stream to FO using the specified context, logger, and picture pool. The results are returned as an array of documents. A number of documents depends on the value of option "prepare-template". If it is "true", two documents will be returned in the array: the first document will contain the template and the last document will contain the text data. Otherwise, the only fo-document is returned.
Parameters:
in - an input stream containing an RTF file
context - a context of RTF2FO
logger - a logger used for logging messaged
pool - a picture pool responsible for saving pictures
implementation - an implementation of W3C DOM used for constructing of documents
Returns:
documents constructed (or null if conversion was cancelled by rtf-filter)

build

public static final RTFDocument build(java.io.InputStream in,
                                      RTF2FOContext context,
                                      CommonLogger logger,
                                      PicturePool pool)
Build an RTF document on the specified input stream, context, logger, and picture pool.
Parameters:
in - an input stream containing an RTF file
context - a context of RTF2FO
logger - a logger used for logging messaged
pool - a picture pool responsible for saving pictures
Returns:
an rtf document

convert

public static org.w3c.dom.Document[] convert(RTFDocument document,
                                             RTF2FOContext context,
                                             CommonLogger logger,
                                             org.w3c.dom.DOMImplementation implementation)
Convert the specified RTF document to FO using the specified context, logger, and picture pool. The results are returned as an array of documents. A number of documents depends on the value of option "prepare-template". If it is "true", two documents will be returned in the array: the first document will contain the template and the last document will contain the text data. Otherwise, the only fo-document is returned.
Parameters:
document - an RTF document to be converted
context - a context of RTF2FO
logger - a logger used for logging messaged
implementation - an implementation of W3C DOM used for constructing of documents
Returns:
documents constructed (or null if conversion was cancelled by rtf-filter)