Sample VB.NET Application
The sample Visual Basic program below illustrates how to use the DocumentComposer (DocumentComposer32 or DocumentComposer64 for Windows operating systems) class to process a document with MathML. The source code is provided so that you can experiment with different techniques for use in your own programs.
Prerequisites for Running the Program
- You must have the .NET 2.0 Framework installed.
- The
DocumentComposer32.dll (for Windows 32-bit systems) or DocumentComposer64.dll (for Windows 64-bit systems) must be registered. Use the command regsvr32 <path to your operating system's specific DLL> to register it. - The
dessci.lic file should be in the same directory as the sample code executable.
Running the Program
To illustrate the use of the Document Composer, there is a sample application in the following directory:
<path-to-mathflow-sdk>/windows/samples/DocumentComposerApplication/DocumentComposerApplication.exe
To run the program, double-click this file. The sample program allows you to change the input parameters used to process an input document with MathML (see below). After changing the input parameters and telling the program where to save the output document, click the Generate Output Document button.

Source Code
The source code for the sample program is located in the following directory:
<path-to-mathflow-sdk>/windows/samples/DocumentComposerApplication/src/DocumentComposerApplication
Use Visual Studio 2005 to open the DocumentComposerApplication.sln file.
Programming Notes
The main functions/subroutines in this program are as follows::
New()
- Instantiates a
MathFlowSDK.DocumentComposer object, which is used throughout the program. - Initializes the program controls with default values
- Sets the options for the Document Composer using the values of the program controls
ProcessDocument()
Within a Try/Catch block:
- Sets the options for the Document Composer using the values of the program controls
- Calls the method to process the input document
SetOptions()
- Sets the value of each option for the Document Composer from the corresponding program control
- The general strategy in the sample application for handling exceptions in the
SetOption methods is:- If an option is required (i.e.,
license or inputdoc) and an exception is thrown by the SetOption method, throw an exception with the error message returned from the SetOption method - If an option is optional and has a default value (e.g.,
pointsize), catch any exception thrown by the SetOption method, retain the warning message for display later and continue processing, using the default value for that option - If an option is optional and does not have a default value (e.g.,
logfile), catch any exception thrown by the SetOption method, retain the resulting message for display later, and call the SetOption method again with an empty string to tell the system not to use that option and continue processing
Note that this only one way in which the options for a Document Composer can be set. Another possible approach would be to call each set method when the value of a program control changes.
GetOptions()
Sets the value of the program controls from the corresponding options of the Document Composer
|