Skip to content

PDF 生成模板编辑器

开源可视化 PDF 生成引擎,支持自定义模板,并提供面向开发者的 API,灵活构建文档生成流程。

查看 GitHub

取消转换任务

ComPDF Conversion SDK 支持随时中断您正在进行的转档任务,以下示例演示了如何中断您正在进行的转档任务。

java
class ProgressClass implements ConvertCallback {
    // When the conversion task is running, set `cancelled` to true to interrupt the ongoing conversion task.
    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());