How to convert PDF file to Excel using Java. We have generate PDF file using itext. Now we want to convert it to excel. we want sample code to convert pdf to excel. or kindly Suggest API.
Asked
Active
Viewed 1.6k times
-2
-
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, [describe the problem](http://meta.stackoverflow.com/questions/254393) and what has been done so far to solve it. – Joe C Mar 16 '18 at 06:11
-
we tried aspose to convert pdf to excel but it is not converting the whole document. Only first line in PDF is converting. – T.Samy Mar 16 '18 at 06:15
1 Answers
2
You can convert a PDF document to an Excel workbook with Aspose.PDF API by using below code snippet. Please ensure using Aspose.PDF for Java 18.2 in your environment.
// Load PDF document
Document document = new Document("Test.pdf");
// Instantiate ExcelSave Option object
ExcelSaveOptions excelsave = new ExcelSaveOptions();
// Save the output to XLS format
document.save("ConvertedFile.xls", excelsave);
In case you notice any problem with generated file, please share it with us by uploading it to any file sharing server like Google Drive, Dropbox etc. Also share your environment details (OS details, JDK/JRE version etc) so that we can try to reproduce and investigate the issue to help you out.
I work with Aspose as Developer Evangelist.

Farhan Raza
- 392
- 1
- 8
-
Thanks for the help. we use the above code and aspose-pdf-18.2.jar in ADF application. – T.Samy Mar 16 '18 at 09:16
-
But Excel file not properly generated. Please check the link https://drive.google.com/open?id=12BnXaiCmLMPjcEz5QOH79lFP8HMtorN- – T.Samy Mar 16 '18 at 09:23
-
OS - Windows Server 2012 R12 Standard JDK - jdk1.8.0_131 JRE - jre1.8.0_144 – T.Samy Mar 16 '18 at 09:59
-
Thank you for sharing requested data. We have been able to reproduce the issue in our environment. A ticket with ID **PDFJAVA-37245** has been logged in our issue management system for further investigation and resolution. We will notify you as soon as the issue is resolved. We are sorry for the inconvenience. – Farhan Raza Mar 16 '18 at 10:40
-
_"Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it."_ was the reason why this question was put on hold - but you still managed to be fast enough to answer. Congrats! – Amedee Van Gasse Mar 16 '18 at 12:42
-
-
-
We are sorry for the delayed response. You may please create posts over Aspose Forums to ensure quicker response. We would like to share with you that, the resultant file was saved in Excel 2003 XML Format. In latest versions of MS Excel it cannot be opened if it has XLS file extension. Please, save the document with "XML" extension. We will be enhancing PDF to XSLX conversion soon. In the meanwhile, please use below code snippet with Aspose.PDF and Aspose.Cells API. – Farhan Raza Apr 03 '18 at 07:38
-
Document document = new Document("D:\\Test.pdf"); ExcelSaveOptions ex = new ExcelSaveOptions(); document.save("D:\\Test.xml" ,ex); com.aspose.cells.Workbook workbook = new com.aspose.cells.Workbook("D:\\Test.xml"); workbook.save("D:\\Test.xlsx", com.aspose.cells.SaveFormat.XLSX); – Farhan Raza Apr 03 '18 at 07:40
-
This piece of code returns exactly the same result as in the attached file by T.Samy @FarhanRaza – Mr Cas Aug 31 '18 at 12:45
-
We have enhanced PDF to Excel rendering in respective API. Would you please test your scenario with latest version and then share your kind feedback with us if you face any problem. – Farhan Raza Sep 01 '18 at 21:37