Skip to content
ComPDF

Get Conversion Progress

ComPDF Conversion SDK obtains conversion progress through the progress callback in CConvertCallback. The following example demonstrates how to get conversion progress while performing a PDF to Word task:

c
#include <stdio.h>

static void Progress(int current_page_count, int total_page_count)
{
    printf("progress: %d / %d\n", current_page_count, total_page_count);
}

CConvertOption option = CPDF_DefaultConvertOption();

CConvertCallback callback = {0};
callback.progress = Progress;

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

The handle field is maintained internally by the SDK during conversion, so it should be initialized to NULL when passed in.