Convert PDF to CSV tutorial shows how to convert PDF to Excel file in C# and Visual Basic .NET using PDF Extractor SDK.

PDF Extractor SDK can be used to extract data from PDF file to Excel documents (e.g. CSV file). Use corresponding source code sample below for PDF to Excel conversion.

C#

using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.PDFExtractor;
using System.Diagnostics;

namespace ConsoleApplication1
{
   class Program
   {
       static void Main(string[] args)
       {
           // Create Bytescout.PDFExtractor.CSVExtractor instance
           CSVExtractor extractor = new CSVExtractor();
           extractor.RegistrationName = "demo";
           extractor.RegistrationKey = "demo";

           // Load sample PDF document
           extractor.LoadDocumentFromFile("sample3.pdf");

           //extractor.CSVSeparatorSymbol = ","; // you can change CSV separator symbol (if needed) from "," symbol to another if needed for non-US locales

           extractor.SaveCSVToFile("output.csv");

           Console.WriteLine();
           Console.WriteLine("Data has been extracted to 'output.csv' file.");
           Console.WriteLine();
           Console.WriteLine("Press any key to continue and open CSV in default CSV viewer (or Excel)...");
           Console.ReadKey();

           Process.Start("output.csv");
       }
   }
}

VB.NET

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Bytescout.PDFExtractor
Imports System.Diagnostics

Namespace ConsoleApplication1
   Class Program
       Shared Sub Main(ByVal args As String())
           ' Create Bytescout.PDFExtractor.CSVExtractor instance
           Dim extractor As New CSVExtractor()
           extractor.RegistrationName = "demo"
           extractor.RegistrationKey = "demo"

           ' Load sample PDF document
           extractor.LoadDocumentFromFile("sample3.pdf")

           'extractor.CSVSeparatorSymbol = "," // you can change CSV separator symbol (if needed) from "," symbol to another if needed for non-US locales

           extractor.SaveCSVToFile("output.csv")

           Console.WriteLine()
           Console.WriteLine("Data has been extracted to 'output.csv' file.")
           Console.WriteLine()
           Console.WriteLine("Press any key to continue and open CSV in default CSV viewer (or Excel)...")
           Console.ReadKey()

           Process.Start("output.csv")
       End Sub
   End Class
End Namespace