Skip to content
Guides

Conversion Guides

ComPDFKit Conversion SDK allows developers to use a simple API to convert PDF to the most commonly used file formats like Word, Excel, PPT, HTML, CSV, PNG, JPEG, RTF, CSV,etc. Provide a wealth of customized conversion options, such as whether to include images or annotations in PDF documents, whether to enable OCR or layout analysis, etc.

Get Conversion Progress

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

c#
void GetProgress(int pageIndex)
{
    // Add the code for the callback function here.
}

OnProgress getPorgress += GetProgress;

string inputFilePath = "***";
string outputFolderPath = "***";
string outputFileName = "***";

CPDFConverterWord converter = CPDFConvertFactroy.CreateConverter(CPDFConvertType.CPDFConvertTypeWord,inputFilePath) as CPDFConverterWord;

CPDFConvertWordOptions wordOptions = new CPDFConvertWordOptions();
wordOptions.IsAllowOCR = false;
wordOptions.IsContainAnnotations = true;
wordOptions.IsContainImages = true;
wordOptions.LayoutOpts = LayoutOptions.RetainPageLayout;

int pageCount = converter.GetPagesCount();
int[] pageArray = new int[pageCount];
for (int i = 0; i < pageArray.Length; i++)
{
    pageArray[i] = i + 1;
}

ConvertError error = ConvertError.ERR_UNKNOWN;
converter.Convert(outputFolderPath, ref outputFileName, wordOptions, pageArray, ref error, getPorgress);