PDF conversion from Excel sheet is taking time


I am trying to convert excel to pdf. Below code snippet. Attached is excel file.

Attached file conversion taking 3 min 7 sec on window 7 machine. Can this be improved further

public static void main(String[]
args) throws Exception {

log .info(“Before
loading file”);

Workbook wb = new Workbook(“H:\TicketExcel.xlsx”);

log .info(“After
loading file”);

PdfSaveOptions optsPDF = new PdfSaveOptions();

optsPDF.setAllColumnsInOnePagePerSheet(true );

log .info(“Before
saving file”);

wb.save(“H:\TicketPDF.pdf”, optsPDF);

log .info(“After
saving file”);


Hi Tauqeer,

Thank you for sharing the sample spreadsheet.

Please note, as you are setting the PdfSaveOptions.AllColumnsInOnePagePerSheet property to true, it will surely take more time for the conversion as compared to normal conversion process that renders the spreadsheet page by page. While setting the PdfSaveOptions.AllColumnsInOnePagePerSheet property to true you are actually overriding the rendering process by instructing the API to render all columns of the worksheet on one PDF page. This needs more memory to process and more time to flush the results.

That said, we have used the latest version of Aspose.Cells for Java 8.6.1 to check the execution time for your exact code. The time to load the spreadsheet is 2250 milliseconds and time to convert it to PDF format is 49624 milliseconds where the total execution time is 51874 milliseconds (0.86 minutes), that is much less than what you have reported. Please give the latest version a try on your side to feed us back with your results.

Environment Details

  • Windows 7 Home Premium x64
  • Oracle’s JDK 1.8.0_60
  • 6 GB RAM
  • Aspose.Cells for Java 8.6.1`


long startTime = System.currentTimeMillis();
Workbook wb = new Workbook(“C:\temp\TicketExcel.xlsx”);
long endTime = System.currentTimeMillis();
System.out.println("Loading time: " + (endTime - startTime) );
PdfSaveOptions optsPDF = new PdfSaveOptions();
startTime = System.currentTimeMillis();
wb.save(“C:\temp\TicketPDF.pdf”, optsPDF);
endTime = System.currentTimeMillis();
System.out.println("Conversion time: " + (endTime - startTime) );