Convert PDF to Word in Objective-C, Kotlin, and C#

Tutorials | Convert · How To Wed. 22 Jun. 2022

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, we'll provide the simplest solution for how to convert PDF to Word using ComPDFKit Conversion SDK. And we support DOCX, the new format of Word documents.

 

 

Supported Types

 

We offer a high-performance conversion SDK to convert PDFs to multiple formats, such as those listed below:

 

- Word

- Excel

- PowerPoint

- HTML

- Text

- CSV

- RTF

- Images

 

If you want to get deeper information, please click here.

 

 

PDF vs Word

 

PDF and DOCX are two popular formats in the computer age. It becomes easier to edit and send documents with these two formats. Though sometimes they can be confusing, they are actually different in many aspects.

 

PDF, short for Portable Document Format, was developed in 1992 by Adobe as a file format. The format is designed to preserve the visual representation of text, images, and drawings, regardless of the environment the document is in.

 

DOCX is a filename extension for Word documents. Word was designed and developed by Microsoft, so it is called Microsoft Word. It is widely accepted as a word processor. And Word format is pretty much the de facto standard when it comes to word processing now.

 

As mentioned above, PDF is a file format for sending and capturing electronic documents entirely in the intended format. Word documents are effortlessly editable and searchable. PDF is password protected, while it is difficult to use passwords to protect Word documents. These are the main differences between PDF and Word.

 

We have learned the respective characteristics of the two formats, now let's see how to convert PDF to Word in simple steps.

 

 

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 our 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.

 

Contact us to get a feel for what’s possible with our SDK.

Ready to Get Started?

Download our all-in-one ComPDFKit for free and run it to your project within minutes!