It is easy to reuse PDF contents in editable file formats, such as Microsoft Word, Excel spreadsheets and PowerPoint presentation. This article gives you an example of how to convert a PDF document to an Excel document by using Spire.PDF for Java.
Installing Spire.Pdf.jar
If you create a Maven project, you can easily import the jar in your application using the following configurations. For non-Maven projects, download the jar file from this link and add it as a dependency in your application.
<repositories>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId> e-iceblue </groupId>
<artifactId>spire.pdf</artifactId>
<version>3.12.6</version>
</dependency>
</dependencies>
Using the code
public class ConvertPdfToExcel {
public static void main(String[] args) {
//Create a PdfDocument instance
PdfDocument pdf = new
PdfDocument();
//Load a PDF file
pdf.loadFromFile("C:\\Users\\Administrator\\Desktop\\table.pdf");
//Save as Excel file
pdf.saveToFile("ToExcel.xlsx", FileFormat.XLSX);
}
}
Besides XLSX, Spire.PDF also supports to convert PDF to various other file format like DOC, DOCX, HTML, XPS, etc.
Output
Write a comment