Skip to content
Guides

Get Conversion Progress

ComPDFKit Conversion SDK obtains the conversion progress through callback functions. The following example demonstrates how to get the conversion progress while performing a PDF to Word task:

In the SDK, the following interfaces are available:

kotlin
interface ProgressCallback {
    fun onProgress(current: Int, total: Int)
}

Implement this interface in your class and override the following function:

kotlin
class ConversionTask(
    var path: String,
    var outputPath: String,
    var options: WordOptions
) : ProgressCallback {

    override fun onProgress(current: Int, total: Int) {
        // Add the callback function code at this location.
    }

    fun startTask() {
        ConverterManager.setProgress(this)
        val errorCode = ComPDFKitConverter.startPDFToWord(path, "", outputPath, options)
    }
}