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

Free Support Forum - aspose.com

java.lang.OutOfMemoryError: Java heap space error encountered while converting excel worksheet to PDF

Scenario:

Attempting to convert an excel worksheet with two images into PDF using a workbook.save(stream, SaveFormat.PDF) call. The excel I’m trying to render is attached. Increasing the max heap size of running Java doesn’t seem to help.

System info:

Intel® Core™ i7-9700 CPU @ 3.00GHz × 8
Ubuntu 18.04.3 LTS
23.4 GiB RAM

Excel worksheet to convert:excel_template.zip (807.3 KB)

Aspose version used: 19.12

@srijal,

Thanks for the template file and details.

Please try our latest version/fix: Aspose.Cells for Java v19.12.4 (attachee)

I simply tested your scenario using the following sample code with v19.12.4, it works fine and the output file is generated in quick time:
e.g
Sample code:

......
FileInputStream io = new FileInputStream(new File(stringFilePath));
        Workbook workbook = new Workbook(io);
		
		 try (OutputStream out = new FileOutputStream(new File(outputPDFPath))) {
			workbook.save(out, SaveFormat.PDF);
		} catch(Exception e) {
			throw new RuntimeException(e);
		} 

Let us know if you still find any issue with v19.12.4.
aspose-cells-19.12.4-java.zip (6.8 MB)