We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to convert the PDF document into Excel?

Platform: WinForms |
Control: PdfViewer

Syncfusion Essential PDF is a .NET PDF library used to create, read, and edit PDF documents. PDF Viewer Control does not convert the PDF document into Excel. However, you can convert the PDF document into Excel by using tabula extractor.

Refer to the following code snippet.

 

//Specify the installation path of java
ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\Program Files\Java\jre1.8.0_144\bin\java.exe");
 
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
 
//Set the input folder path to WorkingDirectory
startInfo.WorkingDirectory = InputPath;
 
startInfo.Arguments = "-jar tabula-0.8.0-jar-with-dependencies.jar -p all -o sample.csv sample.pdf";
 
//The ‘sample.csv’ file has been generated in the specified working directory when started the ProcessStartInfo
Process currentProcess=Process.Start(startInfo);
 
currentProcess.WaitForExit();
 
string[] files = Directory.GetFiles(InputPath, "*.csv");
 
ExcelEngine excelEngine = new ExcelEngine();
 
IApplication application = excelEngine.Excel;
 
IWorkbook workbook = application.Workbooks.Open(files[0]);
 
IWorksheet sheet = workbook.Worksheets[0];
 
application.DefaultVersion = ExcelVersion.Excel2013;
 
workbook.Version = ExcelVersion.Excel2013;
 
string fileName = "sample.xlsx";//Saves the Excel file into specific location
workbook.SaveAs("../../Output/"+fileName,ExcelSaveType.SaveAsXLS);
 
workbook.Close();
 
excelEngine.Dispose();

Sample link:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfToExcelConversionSample-2083476702


Note:
  1. The latest version of Java should be installed in your machine to execute the previous sample and refer to the installation path while creating the ProcessStartInfo.
  2. Place the input PDF file and tabula executable jar file in “Resource\target” folder in the previous sample.

 

Conclusion

I hope you enjoyed learning about how to convert PDF to excel in C# and VB.NET.

You can refer to our .NET PDF library’s feature tour page to know about its other groundbreaking feature representations. You can also refer to our .NET PDF documentation that shows how to configure the PDF Library in .NET.

For current customers, you can check out our File Formats from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our .NET PDF and other File Formats framework.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile