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

Free Support Forum - aspose.com

java.lang.OutOfMemoryError: Java heap space Reading simple PDF

I am trying to convert a PDF pages to images just using the code from the documentation and I am getting a out of heap space error.

I have increased the JVM memory but I still get the error.

here is the code

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(“input.pdf”);

// Loop through all the pages of PDF file

for (int pageCount = 1; pageCount

// Create stream object to save the output image

java.io.OutputStream imageStream = new java.io.FileOutputStream(“Converted_Image” + pageCount + “.jpg”);

// Create Resolution object

com.aspose.pdf.devices.Resolution resolution = new com.aspose.pdf.devices.Resolution(300);

// Create JpegDevice object where second argument indicates the quality of resultant image

com.aspose.pdf.devices.JpegDevice jpegDevice = new com.aspose.pdf.devices.JpegDevice(resolution, 100);

// Convert a particular page and save the image to stream

jpegDevice.process(pdfDocument.getPages().get_Item(pageCount), imageStream);

// Close the stream



and this is the error.

Exception in thread “AgentThread: JavaAgent” java.lang.OutOfMemoryError: Java heap space

at java.lang.StringCoding.decode(StringCoding.java:505)

at java.lang.String.(String.java:241)

at java.util.jar.Manifest.parseName(Manifest.java:262)

at java.util.jar.Manifest.read(Manifest.java:216)

at java.util.jar.Manifest.(Manifest.java:62)

at java.util.jar.JarFile.getManifestFromReference(JarFile.java:170)

at java.util.jar.JarFile.getManifest(JarFile.java:153)

at sun.misc.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:944)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:465)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:451)

at java.net.URLClassLoader.access$300(URLClassLoader.java:79)

at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1038)

at java.security.AccessController.doPrivileged(AccessController.java:365)

at java.net.URLClassLoader.findClass(URLClassLoader.java:429)

at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:281)

at java.lang.ClassLoader.loadClass(ClassLoader.java:677)

at java.lang.ClassLoader.loadClass(ClassLoader.java:643)

at com.aspose.pdf.internal.p357.z2.(Unknown Source)

at com.aspose.pdf.internal.p597.z2.m1(Unknown Source)

at com.aspose.pdf.internal.p634.z8.(Unknown Source)

at com.aspose.pdf.internal.p631.z12.m1(Unknown Source)

at com.aspose.pdf.internal.p561.z6.(Unknown Source)

at com.aspose.pdf.internal.p598.z2.m1(Unknown Source)

at com.aspose.pdf.internal.p564.z7.m1(Unknown Source)

at com.aspose.pdf.devices.z1.m1(Unknown Source)

at com.aspose.pdf.devices.z1.m1(Unknown Source)

at com.aspose.pdf.devices.ImageDevice.m1(Unknown Source)

at com.aspose.pdf.devices.JpegDevice.processInternal(Unknown Source)

at com.aspose.pdf.devices.JpegDevice.process(Unknown Source)

at JavaAgent.NotesMain(Unknown Source)

at lotus.domino.AgentBase.runNotes(Unknown Source)

at lotus.domino.NotesThread.run(Unknown Source)

I am not sure if this is important but the PC running this code is not connected to the internet.

Also it is running an a IBM Notes client.


Hi Daniel,

Thanks for your inquiry. We will appreciate it if you please share your sample PDF document here, We will test the scenario at our end and will guide you accordingly.

Moreover, please note Aspose.PDF jar does not need .net connection for processing.

Best Regards,

I get the error with any pdf file that I use.

I have tried a lot of different ones. Just a plain text readme.pdf gives the error.

Hi Daniel,

Thanks for your feedback. My JVM heap size parameters are as following, please give a try to the following parameters and share the results. If issue persist then please share your sample PDF document and environment details here as well, so we will try to replicate the issue at our end and will provide you information accordingly.



We are sorry for the inconvenience caused.

Best regards,

I am also running a 32 bit version of Notes.

Would this make a difference?

Hi Daniel,

From above description, do you mean 32 bit version of JDK or 32 Bit version of Operating System. Please share some further details, so we may further look into this matter.

32 bit of both.

I have narrowed it down to the Domino JVM running out of memory.

Not sure how I am going to get it running. Have there been other users using Aspose in an IBM Notes client?

Hi Daniel,

We are sorry for the inconvenience. As suggested above, can you please confirm increasing maximum heap size of your JVM worked or not? You may increase HTTPJVMMaxHeapSize value notes.ini as per your Domino version and share the results.

Best Regards,

I got it working finally.

I changed the Notes.ini setting in the Notes client (not the server).


Note that this is not the HTTPJavaHeapSize setting.

Hi Daniel,

Thanks for your feedback. It is good to know that you have managed to resolve the issue.

Please keep using Aspose.Pdf and feel free to ask any question or concern, we will be more than happy to extend our support.

Best Regards,