Skip to content

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:

// Get the path of the PDF file.
NSString *pdfPath = @"...";
// Get the path to the Word file.
NSString *outputPath = @"...";
CPDFConvertWordOptions *options = [[CPDFConvertWordOptions alloc] init];
// Set the OCR language, which takes effect only when IsAllowOCR is true.
[options setIsAllowOCR:YES];
// Whether to contain images when converting,which takes effect only when IsAllowOCR is false.
[options setIsContainImages:NO];
// Set whether to contain background images, which takes effect only when IsAllowOCR is true. 
[options setIsContainOCRBgImage:NO];
// Whether to contain annotations when converting.
[options setIsContainAnnotations:NO];
 // PDF to Word conversion parameter object (derived class of CPDFConvertOptions)Layout Options:CPDFConvertRetainPageLayout: Retain the same layout as your original file by splitting the text into multiple text boxes accoring to its layout.
[options setLayoutOptions:CPDFConvertRetainPageLayout];
// OCR language is English.
[options setLanguage:COCRLanguageEnglish];
CPDFConverterWord *converter = [[CPDFConverterWord alloc] initWithURL:[NSURL fileURLWithPath:pdfPath] password:nil];
[converter convertToFilePath:outputPath pageIndexs:nil options:options];