KeyView 24.2

# Run Export Out of Process

The `HtmlTest.java` sample program demonstrates how to run Export out of process.

To convert files out of process in the Java API

1. If required, set parameters for the out-of-process conversion in the `formats_e.ini` file. See Configure Out-of-Process Conversions.

2. Create an instance of the `HtmlExport` class.

       HtmlExport objHtmlExport = new HtmlExport("YOUR_KEYVIEW_LICENSE");

3. If you are using a template file to set the conversion options, call the `setIniFileName` method.

       objHtmlExport.setIniFileName(iniFile);

4. If you are using the API to set the conversion options, create instances of the following classes:

       HtmlOptionInfo
       HtmlTemplateInfo
       HtmlTOCOptionInfo
       StyleMapping
       HtmlHeadingInfo

   Set the classes to the current `HtmlExport` object using the appropriate set methods. If you do not set the classes before calling the `startOOPSession` method, default values are used.

5. Set the location of the Export libraries by calling the `setExportDirectory` method. These are normally in the directory `install\OS\bin`, where `install` is the path name of the Export installation directory and `OS` is the name of the operating system.

       objHtmlExport.setExportDirectory(exportDir);

6. Optionally, set the input source as either a file or stream by calling the `setInputSource` method.

       // set the input source as a file
       objHtmlExport.setInputSource(inFile);

       // or set the input source as a stream
       inf = new File(inFile);
       fis = new FileInputStream(inf);
       objHtmlExport.setInputSource(fis);

   The `setInputSource` method also accepts a `com.verity.api.SeekableInputStream`. OpenText recommends that you use this option, because it allows KeyView to seek in the file, only reading the parts it needs to read. If you need to use a Java `InputStream`, and you know the stream length, there is a method overload that allows the size to be passed in. Using this might allow KeyView to avoid caching the whole file. For more information, see Input/Output Operations.

7. Set up an out-of-process session by calling the `startOOPSession` method. This initializes the out-of-process session, creates a Servant process, establishes a communication channel between the application thread and the Servant, and sends the data to the Servant.

       objHtmlExport.startOOPSession();

8. Convert the input and generate the output files by calling the `convertTo` method. You cannot use the `convert` methods that set the input source because the input source must be set before the out-of-process session is initialized. The `convertTo` method can only be called once in a single out-of-process session.

       objHtmlExport.convertTo(outFile);

9. Terminate the out-of-process session by calling the `endOOPSession` method. The Servant ends the current conversion session, and releases the source data and session resources.

       objHtmlExport.endOOPSession(TRUE);

10. Repeat Step 3 through Step 9 for additional files.

11. After all files are converted, terminate the out-of-process session and the Servant process by calling `endOOPSession` and setting the Boolean to `FALSE`.

        objHtmlExport.endOOPSession(FALSE);

12. Terminate the Export session and free allocated system resources by calling the `shutdownExport()` method.

        objHtmlExport.shutdownExport();

Copyright 1997-2024 Open Text
Version 24.2 | Last updated March 2024

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: IDOL KeyView 24.2

Topic Title: Run Export Out of Process