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

Free Support Forum - aspose.com

Aspose.cells V20.7 - java.lang.OutOfMemoryError: Java heap space

Hi,

We try to convert an Excel file to PDF with Aspose.cell 20.7 trial version. We got error about Java heap size.
We used following java options
-Xms2024m -Xmx4098m
-Xms4098m -Xmx6000m

For info, PDF file is created but cannot be read by Acrobat.

We need to solve this issue before purchasing licence. Could you please advise?

Regards,

@elie.kach,

Please zip the Excel file and attach it here, we will check your issue soon.

zip file is over 12 Mega. Do you have any share device (cloud)

@elie.kach,
You may upload the file to some public file sharing server like google drive, dropbox etc and share the link here for downloading. We will test the scenario and share our feedback.

Hi,
Here is the link to dropbox

@elie.kach,

Please try our latest version/fix: Aspose.Cells for Java v20.9.2 (attached)
aspose-cells-20.9.2-java.zip (7.2 MB)

I tested your scenario/case by converting your file to PDF and it works fine with the attached version. The output PDF file is ok and can be opened fine into Adobe acrobat. But as the pages are more than 634K, so it takes some time to browse pages in adobe acrobat.

By the way, I checked your Excel file and found that the worksheet named “HS Classifications” has more than 624K pages, so you may imagine why it is taking more time to render the PDF file. I also noticed there are unnecessary blank pages mostly in the worksheet “HS Classifications”.

Hi
I try it with version 20.9.2 but still having trouble.
Error:
java.lang.OutOfMemoryError: Java heap space
at com.aspose.cells.zbdr.a(Unknown Source)
at com.aspose.cells.zbd.d(Unknown Source)

I use these java option:
-Xms4048m -Xmx6000m

Source code:
public static String convertCells2PDF(String sourceFile, String outputFile) {
Workbook workbook;
try {
workbook = new Workbook(sourceFile);
//This line is important-------------------
workbook.calculateFormula();

		PdfSaveOptions opts = new PdfSaveOptions();
		opts.setOnePagePerSheet(true);
		
		// Save the document in PDF format
		workbook.save(outputFile, opts);
		return outputFile;
		}
	catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}

@elie.kach,

Your code is not right as you are trying one page per sheet option on. Since some worksheets have thousands of pages so how could you make one page for those bigger sheets. Please note, this option would consume more and more resources for no output. Kindly do not set this option in code and then try your scenario.

Thank you, it works fine now.
Regards

@elie.kach,
You are welcome.