Skip to content
DemoFAQ

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub

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)
    }
}