com.dessci.mathflow.sdk.composer
Class DocumentComposer

java.lang.Object
  extended by com.dessci.mathflow.sdk.composer.DocumentComposer
All Implemented Interfaces:
com.dessci.mathflow.sdk.composer.ComposerConstants, com.dessci.mathflow.sdk.license.LicenseConstants, webeq3.parser.html.ParserConstants

public class DocumentComposer
extends java.lang.Object
implements com.dessci.mathflow.sdk.license.LicenseConstants, webeq3.parser.html.ParserConstants, com.dessci.mathflow.sdk.composer.ComposerConstants

This class is used to transform MathML embedded in documents to add additional information (e.g., spoken speech for the equation) or replace it with images. It can produce EPS (Windows only), GIF, and PNG image types.


Field Summary
 
Fields inherited from interface com.dessci.mathflow.sdk.license.LicenseConstants
debugMode, DESSCI_KEY, DOCUMENT_COMPOSER, DOCUMENT_COMPOSER_FOR_JAVA, DSI_LICENSE_DAEMON, EQUATION_COMPOSER, EQUATION_COMPOSER_FOR_JAVA, EVAL_LICENSE_FOR_APPLETS, FLEXLM_LIB_NAME, FLEXLM_LIC, LICENSE_EXPIRED, LICENSE_FILE_NAME, LICENSE_FOLDER_NAME, LICENSE_ID, LICENSE_INVALID, LICENSE_NOT_AVAILABLE, LICENSE_OK, SIMPLE_EDITOR, STRUCTURE_EDITOR, STYLE_EDITOR
 
Fields inherited from interface webeq3.parser.html.ParserConstants
DSTag, DSTagSp, EOF, htmlClosed, htmlEmptyEnd, htmlEmptyStart, htmlNone, htmlUnclosed, htmlXMLEmpty, parseBAD_HTML, parseGOOD_HTML, parseXML
 
Fields inherited from interface com.dessci.mathflow.sdk.composer.ComposerConstants
_IMAGES, _OUT, ANTIALIASINGOFF, BACKGROUND, BG, BLACK, BREAKWIDTH, CHARMAP, DEBUG, DPI, FALSE, FG, FONT_MAPPING_FILE, FONTMAPPING, FONTMETRICS, FOREGROUND, GIF, IMAGEFOLDER, IMAGENAME, IMAGES, IMAGETYPE, IMG, IMGTYPE, INPUTDOC, LICENSE, LOGFILE, MATHML, MATHMLFILE, MUTE, NONE, NORMAL, OPDICT, OPTIONS, OUTPUTDOC, OUTPUTTYPE, PADDING, PNG, POINTSIZE, READOPTIONS, SAVEOPTIONS, SIZE, TAB, TRANSPARENT, TRUE, VERBOSITY, WHITE
 
Constructor Summary
DocumentComposer()
           
 
Method Summary
 void ClearLastMessage()
          Clears the last saved message string.
 java.lang.String GetBackground()
          Returns the background color of the equation.
 int GetBreakWidth()
          Returns the width in pixels where line wrapping for long equations should occur, or 0 if line wrapping is disabled.
 java.lang.String GetCharMap()
          Returns the path to the character mapping file.
 int GetDPI()
          Returns the DPI for the equation image.
 java.lang.String GetFontMapping()
          Returns the path to the font mapping file.
 java.lang.String GetForeground()
          Returns the foreground color of the equation.
 java.lang.String GetImageFolder()
          Returns the path to the folder that will contain the image files.
 java.lang.String GetImageName()
          Returns the base file name for the equation image.
 java.lang.String GetImageType()
          Returns the type of the equation image.
 java.lang.String GetInputDoc()
          Returns the path to the source document that needs to be processed.
 java.lang.String GetLastMessage()
          Returns the last saved message string.
 java.lang.String GetLicense()
          Returns the path to the FlexLM license file or the MathFlow SDK registration key, depending on the license type.
 java.lang.String GetLogFile()
          Returns the path to the log file that we write error messages to.
 java.lang.String GetOperatorDictionary()
          Returns the path to the operator dictionary file
 java.lang.String GetOutputDoc()
          Returns the path to the target document that we output into.
 java.lang.String GetOutputType()
          Returns the equation output type for processing the document.
 int GetPadding()
          Returns the padding around the border of the equation image.
 int GetPointSize()
          Returns the base point size of the equation.
 java.lang.String GetVerbosity()
          Returns what processing messages should be displayed.
 boolean IsFontMetricsEnabled()
          Returns whether metrics should appear in the output file.
static void main(java.lang.String[] args)
           
 void ProcessDocument()
          Processes the specified source document to transform the MathML into images and outputs into the specified target document.
 void ReadOptions(java.lang.String readoptions)
          Reads all the settings from the specified XML file.
 void SaveOptions(java.lang.String saveoptions)
          Writes all the settings to the specified XML file.
 void SetBackground(java.lang.String bg)
          Sets the background color for the equation.
 void SetBreakWidth(int breakwidth)
          Sets the width where line wrapping for long equations should occur.
 void SetCharMap(java.lang.String charmap)
          Sets the path to the character mapping file.
 void SetDPI(int dpi)
          Sets the DPI for the equation image.
 void SetFontMapping(java.lang.String fontmapping)
          Sets the path to the font mapping file.
 void SetFontMetrics(boolean fontmetrics)
          Sets whether metrics should appear in the output file.
 void SetForeground(java.lang.String fg)
          Sets the foreground color for the equation.
 void SetImageFolder(java.lang.String imagefolder)
          Sets the path to the folder that will contain the image files.
 void SetImageName(java.lang.String imagename)
          Sets the base file name for the equation image.
 void SetImageType(java.lang.String imagetype)
          Sets the type of the equation image.
 void SetInputDoc(java.lang.String inputdoc)
          Sets the path to the source document that needs to be processed.
 void SetLicense(java.lang.String license)
          Sets the path to the FlexLM license file or the MathFlow SDK registration key.
 void SetLogFile(java.lang.String logfile)
          Sets the path to the log file that we write error messages to.
 void SetOperatorDictionary(java.lang.String filepath)
          Sets the path to the operator dictionary file
 void SetOutputDoc(java.lang.String outputdoc)
          Sets the path to the target document that we output into.
 void SetOutputType(java.lang.String outputtype)
          Sets the equation output type for processing the document.
 void SetPadding(int padding)
          Sets the padding around the border of the equation image.
 void SetPointSize(int pointsize)
          Sets the base point size of the equation.
 void SetVerbosity(java.lang.String verbosity)
          Sets what processing messages should be displayed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentComposer

public DocumentComposer()
Method Detail

ClearLastMessage

public void ClearLastMessage()
Clears the last saved message string.


GetBackground

public java.lang.String GetBackground()
Returns the background color of the equation.

Returns:
the background color of the equation

GetBreakWidth

public int GetBreakWidth()
Returns the width in pixels where line wrapping for long equations should occur, or 0 if line wrapping is disabled.

Returns:
the width where line wrapping for long equations should occur or 0 if line wrapping is disabled

GetCharMap

public java.lang.String GetCharMap()
Returns the path to the character mapping file.

Returns:
the path to the character mapping file

GetDPI

public int GetDPI()
Returns the DPI for the equation image.

Returns:
the DPI for the equation image

GetFontMapping

public java.lang.String GetFontMapping()
Returns the path to the font mapping file.

Returns:
the path to the font mapping file

GetForeground

public java.lang.String GetForeground()
Returns the foreground color of the equation.

Returns:
the foreground color of the equation

GetImageFolder

public java.lang.String GetImageFolder()
Returns the path to the folder that will contain the image files.

Returns:
the path to the folder that will contain the image files

GetImageName

public java.lang.String GetImageName()
Returns the base file name for the equation image.

Returns:
the base file name for the equation image

GetImageType

public java.lang.String GetImageType()
Returns the type of the equation image. The valid values are "png" and "gif".

Returns:
the image type

GetInputDoc

public java.lang.String GetInputDoc()
Returns the path to the source document that needs to be processed.

Returns:
the path to the source document that needs to be processed

GetLastMessage

public java.lang.String GetLastMessage()
Returns the last saved message string.

Returns:
the last saved message string

GetLicense

public java.lang.String GetLicense()
Returns the path to the FlexLM license file or the MathFlow SDK registration key, depending on the license type.

Returns:
the path to the FlexLM license file or the MathFlow SDK registration key, depending on the license type.

GetLogFile

public java.lang.String GetLogFile()
Returns the path to the log file that we write error messages to.

Returns:
the path to the log file

GetOperatorDictionary

public java.lang.String GetOperatorDictionary()
Returns the path to the operator dictionary file

Returns:
the path to the operator dictionary file

GetOutputDoc

public java.lang.String GetOutputDoc()
Returns the path to the target document that we output into.

Returns:
the path to the target document that we output into

GetOutputType

public java.lang.String GetOutputType()
Returns the equation output type for processing the document. The valid values are "mathml" and "images". If the type is "mathml", we reserve the original MathML and add "altimg" attribute mapping to the generated equation image to the element. If the type is "images", we replace the original MathML with element which maps to the equation image.

Returns:
the equation output type for processing the document. The default is "mathml".

GetPadding

public int GetPadding()
Returns the padding around the border of the equation image.

Returns:
the padding around the border of the equation image

GetPointSize

public int GetPointSize()
Returns the base point size of the equation.

Returns:
the base point size of the equation

GetVerbosity

public java.lang.String GetVerbosity()
Returns what processing messages should be displayed. The valid values are "mute", "normal", and "debug".

Returns:
the level of processing information that should be displayed

IsFontMetricsEnabled

public boolean IsFontMetricsEnabled()
Returns whether metrics should appear in the output file. The valid values are TRUE and FALSE.

Returns:
whether metrics should appear in the output file

main

public static void main(java.lang.String[] args)

ProcessDocument

public void ProcessDocument()
                     throws com.dessci.mathflow.sdk.license.LicenseException,
                            java.lang.StringIndexOutOfBoundsException
Processes the specified source document to transform the MathML into images and outputs into the specified target document.

Throws:
com.dessci.mathflow.sdk.license.LicenseException
java.lang.StringIndexOutOfBoundsException

ReadOptions

public void ReadOptions(java.lang.String readoptions)
                 throws java.lang.Exception
Reads all the settings from the specified XML file.

Parameters:
readoptions - the XML file that contains all the settings
Throws:
java.lang.Exception

SaveOptions

public void SaveOptions(java.lang.String saveoptions)
                 throws java.lang.Exception
Writes all the settings to the specified XML file.

Parameters:
saveoptions - the XML file that we write the settings to
Throws:
java.lang.Exception

SetBackground

public void SetBackground(java.lang.String bg)
                   throws java.lang.IllegalArgumentException
Sets the background color for the equation.

Parameters:
bg - the background color of the equation, in the format of #rgb, #rrggbb or the HTML color name
Throws:
java.lang.IllegalArgumentException

SetBreakWidth

public void SetBreakWidth(int breakwidth)
                   throws java.lang.IllegalArgumentException
Sets the width where line wrapping for long equations should occur.

Parameters:
breakwidth - the width where line wrapping for long equations should occur or 0 if line wrapping is disabled
Throws:
java.lang.IllegalArgumentException

SetCharMap

public void SetCharMap(java.lang.String charmap)
                throws java.lang.IllegalArgumentException
Sets the path to the character mapping file.

Parameters:
charmap - the full path to the character mapping file
Throws:
java.lang.IllegalArgumentException

SetDPI

public void SetDPI(int dpi)
            throws java.lang.IllegalArgumentException
Sets the DPI for the equation image.

Parameters:
dpi - the DPI for the equation image
Throws:
java.lang.IllegalArgumentException

SetFontMapping

public void SetFontMapping(java.lang.String fontmapping)
Sets the path to the font mapping file.

Parameters:
fontmapping - the path to the font mapping file

SetFontMetrics

public void SetFontMetrics(boolean fontmetrics)
                    throws java.lang.IllegalArgumentException
Sets whether metrics should appear in the output file. The valid values are TRUE and FALSE. If the output type is "images", fontmetrics is set to FALSE.

Parameters:
fontmetrics - whether metrics should appear in the output file
Throws:
java.lang.IllegalArgumentException

SetForeground

public void SetForeground(java.lang.String fg)
                   throws java.lang.IllegalArgumentException
Sets the foreground color for the equation.

Parameters:
fg - the foreground color for the equation, in the format of #rgb, #rrggbb or the HTML color name
Throws:
java.lang.IllegalArgumentException

SetImageFolder

public void SetImageFolder(java.lang.String imagefolder)
                    throws java.lang.IllegalArgumentException
Sets the path to the folder that will contain the image files. The folder will be created if it does not already exist.

Parameters:
imagefolder - the path to the folder that will contain the image files
Throws:
java.lang.IllegalArgumentException

SetImageName

public void SetImageName(java.lang.String imagename)
                  throws java.lang.IllegalArgumentException
Sets the base file name for the equation image. The file will be overwritten if it already exists.

Parameters:
imagename - the base file name for the equation image
Throws:
java.lang.IllegalArgumentException

SetImageType

public void SetImageType(java.lang.String imagetype)
                  throws java.lang.IllegalArgumentException
Sets the type of the equation image. The valid values are "png" and "gif".

Parameters:
imagetype - the image type
Throws:
java.lang.IllegalArgumentException

SetInputDoc

public void SetInputDoc(java.lang.String inputdoc)
                 throws java.lang.IllegalArgumentException
Sets the path to the source document that needs to be processed.

Parameters:
inputdoc - the path to the source document that needs to be processed
Throws:
java.lang.IllegalArgumentException

SetLicense

public void SetLicense(java.lang.String license)
                throws com.dessci.mathflow.sdk.license.LicenseException,
                       java.lang.StringIndexOutOfBoundsException
Sets the path to the FlexLM license file or the MathFlow SDK registration key.

Parameters:
license - the path to the FlexLM license file or the MathFlow SDK registration key
Throws:
com.dessci.mathflow.sdk.license.LicenseException
java.lang.StringIndexOutOfBoundsException

SetLogFile

public void SetLogFile(java.lang.String logfile)
                throws java.lang.IllegalArgumentException
Sets the path to the log file that we write error messages to.

Parameters:
logfile - the path to the log file
Throws:
java.lang.IllegalArgumentException

SetOperatorDictionary

public void SetOperatorDictionary(java.lang.String filepath)
                           throws java.lang.IllegalArgumentException
Sets the path to the operator dictionary file

Parameters:
filepath - the full path to the operator dictionary file
Throws:
java.lang.IllegalArgumentException

SetOutputDoc

public void SetOutputDoc(java.lang.String outputdoc)
                  throws java.lang.IllegalArgumentException
Sets the path to the target document that we output into.

Parameters:
outputdoc - the path to the target document that we output into
Throws:
java.lang.IllegalArgumentException

SetOutputType

public void SetOutputType(java.lang.String outputtype)
                   throws java.lang.IllegalArgumentException
Sets the equation output type for processing the document.

Parameters:
outputtype - the equation output type for processing the document. The valid values are "mathml" and "images".
Throws:
java.lang.IllegalArgumentException
See Also:
GetOutputType()

SetPadding

public void SetPadding(int padding)
                throws java.lang.IllegalArgumentException
Sets the padding around the border of the equation image.

Parameters:
padding - the padding around the border of the equation image
Throws:
java.lang.IllegalArgumentException

SetPointSize

public void SetPointSize(int pointsize)
                  throws java.lang.IllegalArgumentException
Sets the base point size of the equation.

Parameters:
pointsize - the base point size of the equation
Throws:
java.lang.IllegalArgumentException

SetVerbosity

public void SetVerbosity(java.lang.String verbosity)
                  throws java.lang.IllegalArgumentException
Sets what processing messages should be displayed. The valid values are "mute", "normal", and "debug".

Parameters:
verbosity - the level of processing information that should be displayed
Throws:
java.lang.IllegalArgumentException

Copyright (c) 2015 Design Science
All rights reserved