Listening to conversion process events

In some cases there is the need to monitor conversion process and to receive update for start, progress and completion of a conversion. For such situations GroupDocs.Conversion expose extension point where the client application may hook up and receive updates.

To enable listening you have to:

Here is a code that demonstrates how to enable listening for GroupDocs.Conversion.

public class ConverterListener implements IConverterListener
{
    public void started()
    {
        System.out.println("Conversion started...");
    }
    public void progress(byte current)
    {
        System.out.println($"... " + current + "% ...");
    }
    public void completed()
    {
        System.out.println("... conversion completed");
    }
}
IConverterListener listener = new ConverterListener();
ConverterSettings settingsFactory = new ConverterSettings
{
    Listener = listener
};
try(Converter converter = new Converter("sample.docx", settingsFactory))
{
    PdfConvertOptions options = new PdfConvertOptions();
    converter.convert("converted.pdf", options);
}

© Aspose Pty Ltd 2001-2022. All Rights Reserved.