Documentation

  • Demos
  • Visit our website
  • Contact us
  • MathType

    • Wiris Quizzes

      • Learning Lemur

        • CalcMe

          • MathPlayer

            • Store FAQ

              • VPAT for the electronic documentation

                • MathFlow

                  • BF FAQ

                    • Home
                    • MathFlow
                    • MathFlow SDK for Developers
                    • Composition (Java and Windows)
                    • Document Composer
                    • Document Composer

                    Document Composer

                    Reading time: 2min

                    Overview

                    Introduction

                    The DocumentComposer class, which is available in both Java and Windows-only versions (including 32- and 64-bit versions), is used to transform MathML embedded in documents into additional information (e.g., spoken speech for the equation in the Windows Composer) or replace it with images. It can produce EPS (Windows only), GIF, and PNG image types.

                    Programming Model

                    The DocumentComposer class is based on a state model. When a DocumentComposer object is instantiated, an internal collection of parameters is initialized. These parameters control licensing, input, output, rendering, font management, persistence and other functions. These internal parameters are modifiable by setter methods, which allow you to change the value of the parameters before an image is generated. Refer to the Java Document Composer API (in the javadocs) or Windows Document Composer API for the DocumentComposer class to see what setter methods are available.

                    Processing a Document

                    Once all of the parameters have been set, a call to ProcessDocument() will transform the MathML and output a new document in the format and location defined by the parameters.

                    Configuring Fonts

                    You can choose which fonts are used when creating equation images. To do this, you need to create font configuration files. See Windows Font Configuration or Java Rendering Engine for more information.

                    Using the API in your program

                    Follow the general steps below to use the Document Composer in your program.

                    Setting the License

                    Before a document can be processed, a valid MathFlow SDK license for the Document Composer must be supplied to the DocumentComposer class (note that this is available in 32- and 64-bit versions for Windows). This is accomplished by using the SetLicense method and passing in either the path and file name of a FlexNet license or the license string for a Design Science key.

                    Specifying the Input

                    To pass the input document to be processed into the Document Composer, use the SetInputDoc method, which sets the path to the source document.

                    Defining the Output

                    The methods that define where the output document and equation images will generated and what tags and attributes will be generated are:

                    • SetOutputDoc
                    • SetOutputType
                    • SetAltText (Windows only)
                    • SetFontMetrics
                    • SetImageName
                    • SetImageType
                    • SetImageFolder

                    Setting Rendering Options

                    The methods that determine how the equations will be rendered are:

                    • SetPointSize
                    • SetDPI
                    • SetForeground
                    • SetBackground
                    • SetBreakWidth (Java only)
                    • SetPadding (Java only)

                    Using Fonts

                    Java

                    Use this method to select which font mapping file is used (see Java Rendering Engine for more information):

                    • SetFontMapping

                    Windows

                    Use these methods to select which fonts are used (see Windows Font Configuration for more information):

                    • SetFontConfig
                    • SetFontInfo
                    • SetBaseFont

                    When the DocumentComposer DLL (note that this is available in 32- and 64-bit versions for Windows) is first loaded, it looks for the font configuration file and the font info file. If either file is present, it is used in the same way as the analogous configuration file passed via the -fontinfo or -fontconfig parameter by the command line component.

                    Saving Your Options

                    At any point in your program, you can save the options you have defined using SaveOptions. To load options previously saved, you would use ReadOptions.

                    Processing a Document

                    Once the parameters have been set, a document can be processed with the ProcessDocument method.

                    Getting Additional Information

                    Use the GetLastMessage method to obtain the latest message string and ClearLastMessage to reset it.

                    The SetVerbosity method specifies the amount of information that will appear in processing messages. These will be displayed to the console unless they are redirected to a log file with the SetLogFile method.

                    Was this article helpful?

                    Yes
                    No
                    Give feedback about this article

                    Related Articles

                    • Composition: Equation Composer
                    • Structure Editor application
                    • Interpolate

                    Document Composer

                    Overview Introduction Programming Model Processing a Document Configuring Fonts Using the API in your program Setting the License Specifying the Input Defining the Output Setting Rendering Options Using Fonts Java Windows Saving Your Options Processing a Document Getting Additional Information

                    Making people’s STEM work more meaningful

                    MathType

                    • MathType for Office Tools
                    • MathType for Mac
                    • MathType for Microsoft 365
                    • MathType for Google Workspace
                    • MathType for LMS
                    • MathType for XML Editors
                    • Arabic notation
                    • Our products accessibility
                    • MathType is online

                    WirisQuizzes

                    Learning Lemur

                    Solutions for Education

                    • Blackboard Learn
                    • Brightspace by D2L
                    • Canvas
                    • Google Classroom
                    • Moodle
                    • Schoology

                    Solutions for Publishing Houses

                    Solutions for Technical Writers

                    Solutions for Chemistry

                    Integrations

                    • HTML Editors
                    • MathType in WordPress

                    Pricing

                    Company

                    Careers

                    Blog

                    Contact Us

                    Buy Now

                    Plugin Downloads

                    © Wiris 2025

                    • Cookie Settings
                    • Cookie Policy
                    • Terms of Use
                    • Privacy Policy / GDPR
                    • Student Data Privacy
                    • Compliance
                    • Powered by Helpjuice
                    Expand