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

Tutorials | Convert · How to Wed. 27 Jul. 2022

When it comes to making a report that contains a lot of numbers, Microsoft Excel is extremely preferred, whether it is a simple budget preparation or a complex tax calculation. However, it is common to find that the information needed is on a PDF document. Retyping a PDF document into an Excel spreadsheet takes hours perhaps, not to mention the huge amount of effort and the number of errors that could be made when retyping. 

 

The best solution to this problem is to use a professional converter to ensure that the PDF is accurately converted into an Excel sheet without errors. In this article, we will share with you how to do that with the advanced ComPDFKit Conversion SDK.

 

 

What Is Excel?

 

Excel is a software program available in the Microsoft Office Package that uses spreadsheets to organize and calculate numbers and data with formulas and functions. Excel has powerful functions and enables you to enter, read and manipulate the data without effort. Excel stores the data in a table format in plenty of boxes called cells that are ordered in rows and columns. XLSX files are the standard extension for Microsoft Excel 2007 and later by default, since it is a more open and structured format.

 

Now we have learned that Excel is certainly a convenient tool when processing numbers and data, then let's see what ComPDFKit Conversion SDK can offer when converting PDF to Excel.

 

 

Why Choose Us?

 

Our SDK provides multiple advantages to optimize your experience.

 

First, as the sensitivity and confidentiality of your information are greatly significant to us, all files uploaded to our PDF converter are 100% safe and other people do not obtain any rights on your documents.

 

Second, all tables in PDF will be extracted accurately. The rows and columns will be the same as in the original file, but fully editable.

 

Third, besides regular PDF files, scanned and image-based PDF documents are supported as well. Using the OCR technology, it is easy to accurately recognize numbers and data.

 

In addition, the new spreadsheets will be in XLSX format and can be used in Microsoft Excel, LibreCalc, OpenCalc, or any other office suite compatible with MS Office.

 

 

How to Convert?

 

Objective-C

// Get the path of the PDF file.
NSString *pdfPath = @"...";
// Get the path to the Excel file.
NSString *outputPath = @"...";

CPDFConverterExcel *converter = [[[CPDFConverterExcel alloc] initWithURL:[NSURL fileURLWithPath:pdfPath] password:nil] autorelease];
[converter convertToFilePath:outputPath pageIndexs:nil options:nil];

 

Kotlin

val cPDFConvert = CPDFConverterExcel(context, uri, "")
val params = CPDFConvertExcelOptions()
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);
CPDFConverterExcel converter = new CPDFConverterExcel(inputFilePath);

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

getPageIndex += GetPageIndex;
CPDFConvertExcelOptions options = new CPDFConvertExcelOptions();
converter.Convert(outputFolderPath, outputFileName, options, pageArray, getPageIndex);

 

 

Conclusion

 

ComPDFKit Conversion SDK is the best solution when you want to turn PDF documents into other formats. For instructions on how to convert PDF Word, PowerPoint, HTML, Text, etc. with the least amount of effort, see our developer guides.

Ready to Get Started?

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