_IPresentationConverterEvents Interface
The _IPresentationConverterEvents interface is used for event handling during the conversion process.
Table 1. The following events are available for subscription:
Event | Event description |
---|---|
OnStartConversion(ConversionMode cm) | Occurs when the presentation conversion is started. In the HTML5 mode, the ConversionMode will always be CM_PRESENTATION_WITH_PLAYER. |
OnStartCollectingData | Occurs when the presentation data collection is started. |
OnStartProcessingData | Occurs when the presentation data processing is started. |
OnSlideProgressChanged(int slideIndex, int totalSlides) | Occurs when the regular slide conversion is finished. |
OnSlideItemProgressChanged | Occurs when the slide conversion progress is changed. |
OnStartProcessingVideo | Occurs when video object processing is started. |
OnVideoProgressChanged(double progress) | Occurs when video object processing progress is changed. Progress in the range of [0–1]. |
OnFinishProcessingVideo | Occurs when presentation data collection is finished. |
OnFinishCollectingData | Occurs when the collecting data about presentation is finished. |
OnFinishProcessingData | Occurs when the presentation data processing is finished. |
OnFinishConversion | Occurs when the presentation conversion is finished. |
OnIdle | Occurs constantly during the conversion process. This event can be used to update the user interface. |
OnStartProcessingAudio | Occurs when audio clip processing is started. |
OnAudioProgressChanged(double progress) | Occurs when audio clip processing progress is changed. Progress in the range of [0–1]. |
OnFinishProcessingAudio | Occurs when audio clip processing is finished. |
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using iSpring;
using System.IO;
using System.Diagnostics;
namespace ispring_samples
{
class Converter
{
static void Main(string[] args)
{
var inFileInfo = new FileInfo(args[0]);
var outFileInfo = new FileInfo(args[1]);
var converter = new PresentationConverter();
try
{
converter.OnStartConversion += new _IPresentationConverterEvents_OnStartConversionEventHandler(converter_OnStartConversion);
converter.OnFinishConversion += new _IPresentationConverterEvents_OnFinishConversionEventHandler(converter_OnFinishConversion);
converter.OpenPresentation(inFileInfo.FullName);
converter.GenerateHtml5Presentation(outFileInfo.FullName, PresentationType.PT_SOLID, string.Empty, null);
converter.Presentation.Close();
}
catch (Exception ex)
{
Console.Out.WriteLine("Error: " + ex.Message);
}
finally
{
Marshal.ReleaseComObject(converter);
}
}
static void converter_OnFinishConversion()
{
Console.Out.WriteLine("Conversion finished");
}
static void converter_OnStartConversion(ConversionMode cm)
{
Console.Out.WriteLine("Conversion started");
}
}
}
C#