We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Facing performance issue in generating PDF

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);

Hi Kishore,


Thank you for contacting Aspose support.

The spreadsheet to PDF conversion time mainly depends on the contents of the spreadsheet. If a given spreadsheet has lots of data, graphics or shape objects such as charts and others, it will definitely take some time for the rendering process. In order to evaluate your presented scenario on our end, we need your sample spreadsheet along with your environment details such as follow.

  • Operating system version
  • Operating system architecture
  • Operating system service pack version (if any)
  • JDK type and version

Moreover, please calculate the execution time on your end. We will use that value to benchmark the execution on our end and perform tests to improve the execution time by tweaking your provided code snippet.

Hi,

Thanks for the response.

The excel sheet is having simple data .Please find the attached excel sheet. To generate the attached excel sheet in the Linux operating System it took around 30 seconds , where as for PDF it took almost 150 seconds.

Hi Kishore,


I am afraid, we are still missing key information to properly investigate this scenario. Most important information to simulate your environment on our end is the following.

  • Flavor and version of Linux
  • Architecture (32bit/64bit)
  • JDK type (OpenJDK/Oracle’s JDK)
  • JDK version

Moreover, please state if we should execute your complete code on this spreadsheet to evaluate the scenario for spreadsheet to PDF conversion or we simply convert it to the PDF while using the following statements. We are asking this because you have probably performed other operations on the provided spreadsheet.

Java

PdfSaveOptions saveOpt = new PdfSaveOptions(SaveFormat.PDF);
workbook.save(pdfOutputPath, saveOpt);