473,289 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,289 developers and data experts.

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

CSV is one of the most popular file formats when it comes to storing tabular data. If you want to manipulate or analyze data in PDF documents, you can convert PDF to CSV format, storing information in the form of tabular rows and columns.


What Is CSV


A Comma Separated Values (CSV) file is a plain text file, containing a list of data. And they may sometimes be referred to as Character Separated Values or Comma Delimited files. They mostly use the comma character to separate or delimit data, but sometimes use other characters like semicolons. You can infer these meanings from the filename.



Since multiple applications can recognize records separated by comma, it’s very convenient to import CSV files. That’s why CSV files are commonly used for exchanging data between different applications, especially when there is a great deal of data to be sent. CSV files can be opened by a wide variety of programs, including Microsoft Excel, Google Sheets, Notepad, etc.


CSV vs Excel

When it comes to data, we usually think of Excel. What CSV and Excel have in common is that they both help store data in tabular format. And there are lots of differences between them. Let’s have a deeper look at the differences.


- Performance: CSV files are just text files, they store data but do not contain formatting, formulas, macros, etc. The data in Excel files can be calculated and you can access formulas, macros, etc.

- Memory: Importing CSV files can be much faster, and it also consumes less memory. Excel files consume more memory when importing data.

- Storage Format: CSV files cannot store the data in charts or graphs format, while Excel files can do that.

- Supported Platforms: CSV files can be opened with any text editor in Windows, while Excel files only can be opened with Microsoft Excel.

- External Data: You cannot connect the CSV files to external data sources to fetch the data, like local workbooks, databases, web, etc. While Excel files can do that.



Convert PDF to CSV


ComPDFKit supports extracting only tables from PDF accurately and converting them to CSV, and one table is converted to one CSV file.



Objective-C

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

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


Kotlin

val cPDFConvert = CPDFConverterCsv(context, uri, "")
val params = CPDFConvertCsvOptions()
val result: ConvertError = cPDFConvert.convert(outputDir, outputfilename, params, pageArrays,
onHandle = onHandleCal,
onProgress = onProgressCal,
onPost = onPostCal)


C#

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

CPDFConverter.Init(resPath);
CPDFConverterCsv converter = new CPDFConverterCsv(inputFilePath);

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

CPDFConverterError error = CPDFConverterError.C_UNKNOWN;
converter.Convert(outputFolderPath,ref outputFileName, pageArray, ref error, getPorgress);


Conclusion


In this blog, we introduced a new file format — CSV. Hope you have a clear understanding after reading the blog. And you can contact us to get a free trial of converting PDF to CSV.
Dec 16 '22 #1
0 3967

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
1
by: Logan X via .NET 247 | last post by:
It's official....Convert blows. I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance...
2
by: Joel Moore | last post by:
Maybe I'm just easily baffled after an all-nighter but I can't seem to figure out how to represent a BitArray as a hexadecimal string. For example: Dim outputBank As New BitArray(8) ...
4
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
5
by: Cally | last post by:
Hello, I would like to convert a field from ntext field found in one database table to float field found in another database table. The reason why I want to do this is a long one. I have...
7
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done...
3
by: Convert TextBox.Text to Int32 Problem | last post by:
Need a little help here. I saw some related posts, so here goes... I have some textboxes which are designed for the user to enter a integer value. In "old school C" we just used the atoi function...
7
by: patang | last post by:
I want to convert amount to words. Is there any funciton available? Example: $230.30 Two Hundred Thirty Dollars and 30/100
1
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.