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.

Cancel Conversion Task

ComPDF Conversion SDK supports interrupting an ongoing conversion task through the cancel callback in CConvertCallback. When the cancel callback returns true, the current conversion task stops as soon as possible.

c
static bool Cancel(void)
{
    return false;
}

CConvertOption option = CPDF_DefaultConvertOption();

CConvertCallback callback = {0};
callback.cancel = Cancel;

CSDKErrorCode code = CPDF_StartPDFToWord(
    CPDF_TEXT("input.pdf"),
    CPDF_TEXT("password"),
    CPDF_TEXT("path/output.docx"),
    option,
    &callback);

If you need to cancel the conversion at a specific time, return true from Cancel based on external state.