获取转换进度
ComPDF Conversion SDK 通过 ProgressCallback 接口的方式获取转换进度,以下示例演示了如何获取执行 PDF 转 Word 任务时的转换进度。
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 = ComPDFConverter.startPDFToWord(path, "", outputPath, options, this)
}
}