Skip to content

获取转换进度

ComPDF Conversion SDK 通过 ProgressCallback 接口的方式获取转换进度,以下示例演示了如何获取执行 PDF 转 Word 任务时的转换进度。

java
class ProgressClass implements ConvertCallback {
    boolean cancelled = false;

    @Override
    public void onProgress(int current, int total) {
        System.out.printf("Current Progress: %d / %d%n", current, total);
    }

    @Override
    public boolean isCancelled() {
        return cancelled;
    }
}

CPDFConversion.startPDFToWord("word.pdf", "", "path/output.docx", new WordOptions(), new ProgressClass());