Hi,
I'm getting the out of memory exception when trying to save an Excel sheet as JPEG:
This is the code I use:
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
imgOptions.setImageFormat(ImageFormat.getJpeg());
imgOptions.setOnePagePerSheet(true);
imgOptions.setHorizontalResolution(300);
imgOptions.setVerticalResolution(300);
imgOptions.setCellAutoFit(true);
imgOptions.setQuality(100);
//Render the sheet with respect to specified image/print options
SheetRender sr = new SheetRender(doc.getWorksheets().get(0), imgOptions);
//Render the image for the sheet
sr.toImage(0, jpegFile.getAbsolutePath());
This is the exception I get every time:
java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferInt.(DataBufferInt.java:41)
at java.awt.image.Raster.createPackedRaster(Raster.java:458)
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1015)
at java.awt.image.BufferedImage.(BufferedImage.java:312)
at com.aspose.cells.b.a.b.a.(Unknown Source)
at com.aspose.cells.a.d.bm.a(Unknown Source)
at com.aspose.cells.bgp.a(Unknown Source)
at com.aspose.cells.bgp.a(Unknown Source)
at com.aspose.cells.SheetRender.toImage(Unknown Source)
My memory settings are as follows:
-Xrs -Xmx768M -Xss4096K -XX:MaxPermSize=512m
I'm attaching the file that fails. I'm using version 8.0.0
Thanks in advance for any help,
Mariusz