PDFs and Word documents are widely used in everyday business. When you need to make a PDF file editable or text searchable, you may want to convert it to a Word document. In this article, I'll provide a solution for how to convert PDF to Word using ComPDFKit Conversion SDK.
How to Convert?
Objective-C
// Get the path of the PDF file.
NSString *pdfPath = @"...";
// Get the path to the Word file.
NSString *outputPath = @"...";
CPDFConverterWord *converter = [[[CPDFConverterWord alloc] initWithURL:[NSURL fileURLWithPath:pdfPath] password:nil] autorelease];
[converter convertToFilePath:outputPath pageIndexs:nil options:nil];
Kotlin
val cPDFConvert = CPDFConverterWord(context, uri, "")
val params = CPDFConvertWordOptions().apply {
imgPixel = ImgPixel.IMG_300
...
}
val result: ConvertError = cPDFConvert.convert(outputDir, outputfilename, params, pageArrays,
onHandle = onHandleCal,
onProgress = onProgressCal,
onPost = onPostCal)
C#
string resPath = "***";
string inputFilePath = "***";
string outputFolderPath = "***";
string outputFileName = "***";
OnProgress getPageIndex = null;
CPDFConverter.Init(resPath);
CPDFConverterWord converter = new CPDFConverterWord(inputFilePath);
int pageCount = converter.GetPagesCount();
int[] pageArray = new int[pageCount];
for (int i = 0; i < pageArray.Length; i++)
{
pageArray[i] = i + 1;
}
getPageIndex += GetPageIndex;
CPDFConvertWordOptions options = new CPDFConvertWordOptions();
converter.Convert(outputFolderPath, outputFileName, options, pageArray, getPageIndex);
Conclusion
You can get a wide variety of benefits by using ComPDFKit Conversion SDK to convert your PDF files to Word documents.
- Process files of any size, even files with 1000+ pages, without any problem.
- No need to compromise on speed to get the highest quality.
- Allow batch conversion.