Skip to content
ComPDF
DemoFAQ
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Get Conversion Progress

ComPDF Conversion SDK obtains the conversion progress through the ProgressCallback interface. The following example demonstrates how to get the conversion progress while performing a PDF to Word task.

kotlin
// Implement the `ConvertCallback` interface to receive conversion progress updates.
class ConversionTask(
    var path: String,
    var outputPath: String,
    var options: WordOptions
) : ConvertCallback {

    override fun onProgress(current: Int, total: Int) {
        println("progress: $current / $total")
    }

    override fun isCancelled() {
        return false
    }

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