Reputation: 55
I have a simple java program that creates .xls file (open office excel file), and I want to save it as pdf. I saw some answers here but none of them worked for me. Is there a simple and free way to do so? The file contains only 1 page of .xls
Thanks
Upvotes: 0
Views: 10281
Reputation: 19
I have published a library that saves files, and handles everything with one line of code only, you can find it here along with its documentation
and the answer to your question is so easy
String path = FileSaver
.get()
.save(fileXls,"file.pdf");
Upvotes: 0
Reputation: 3709
Not sure, please provide more details , share code so that the answer can be more precise, but for code perspective it can be achieved via Apache POI.something like below ....
//Instantiate a new workbook with excel file path
Workbook workbook = new Workbook("F:\\FileTemp\\Book1.xls");
//Save the document in Pdf format
workbook.save("F:\\FileTemp\\MyPdfFile.pdf", FileFormatType.PDF);
Upvotes: 3