Hi,
I am converting excel to PDF using Aspose . I am facing performance issue in generating PDF reports . It is taking 20 to 30 seconds in generating excel report where as for PDF it is taking more than one minute.Below is the code I am using for PDF . Please suggest me.
for(int index=0; index<workbook.getWorksheets().getCount(); index++)
{
Worksheet ws = workbook.getWorksheets().get(index);
ws.autoFitRows(true);
}
//Accessing the first worksheet in the Excel file
Worksheet sheet = workbook.getWorksheets().get(ZERO);
PageSetup printPageSetup = sheet.getPageSetup();
//Setting the orientation to Portrait
printPageSetup.setOrientation(PageOrientationType.PORTRAIT);
printPageSetup.setLeftMargin(HALF);
printPageSetup.setRightMargin(HALF);
printPageSetup.setTopMargin(ONE);
//Setting the printing order of the pages to over then down
printPageSetup.setOrder(PrintOrderType.OVER_THEN_DOWN);
if(!reportFormat)
{
printPageSetup.setPrintTitleColumns("$A:$A");
//Defining row numbers 1 - 2 as title rows
printPageSetup.setPrintTitleRows("$3:$13");
}
printPageSetup.setFooter (ONE, " &12 &B Page &P of &N");
printPageSetup.setFitToPagesTall(ZERO);
if(noOfColumns>EIGHT)
{
int remainder=noOfColumns%EIGHT;
int setNoOfPages=noOfColumns/EIGHT;
if(remainder>0)
{
setNoOfPages=setNoOfPages+ONE;
}
printPageSetup.setFitToPagesWide(setNoOfPages);
}
sheet.autoFitRows();
pdfOutputPath=pdfOutputPath.substring(ZERO,pdfOutputPath.length()-THREE);
pdfOutputPath=pdfOutputPath+"pdf";
PdfSaveOptions saveOpt = new PdfSaveOptions(SaveFormat.PDF);
workbook.save(pdfOutputPath, saveOpt);