How to convert Pdf to Excel file in Java

Hello,



I doesn’t understand your api properly. Please send me same sample code, how to convert pdf to excel file.



Thanks,
Rakesh kumar
Adeptia Inc.
Hello Rakesh,

Thanks for showing your interests in GroupDocs.Conversion for Java 3.x.

Let me briefly explain you that how you can achieve your goal using GroupDocs.Conversion for Java 3.x API. Our document conversion API allows user to convert PDF documents to Excel Spreadsheets with full control
First you have to initialize an object of ConvertionHandler class by passing an object of ConversionConfig to its constructor..

ConversionHandler conversionHandler = new ConversionHandler(new ConversionConfig());

Now initialize an object of CellsSaveOptions and set the options for Excel Spreadsheet using its object.

CellsSaveOptions saveOption = new CellsSaveOptions();
saveOption.setOutputType(OutputType.String);
saveOption.setPageNumber(2);
saveOption.setNumPagesToConvert(2);

Now call convert method of ConversionHandler by passing it the path of the source file and the object of CellsSaveOptions class, this method will return path of the converted Excel Spreadsheet.

String convertedDocumentPath = conversionHandler. convert(fileName, saveOption);

Furthermore, please have a look into following resources.:
Download API
API Documentation
Showcases and Example Projects

Best Wishes

hello,



Whenever i am runnig the code you have send me it shows same errore as given below:

java.lang.UnsupportedClassVersionError: com/groupdocs/conversion/converter/option/SaveOptions : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Exception in thread “main”

Please help out thier it urgent.

Thanks,

Rakesh Kumar
Adeptia Inc.

@rakesh.kumar

We have an open-source example project for you using that you can easily convert a PDF to Excel format.
We’d recommend you to migrate to latest version of the API that is 20.6. Document conversion is quite simplified since API version 20.x.

Converter converter = new Converter("sample.pdf");
SpreadsheetConvertOptions options = new SpreadsheetConvertOptions();
converter.convert("converted.xlsx", options);

You may find this documentation article helpful.