Free Support Forum -

DWG to PDF conversion error for >10 MB .dwg files

We are using the Asppose.CAD java libraries. We are facing the out of memory exception when we are converting the .dwg to .pdf.

We are using the .dwg files which are greater than 10 MB.

Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(
at sun.misc.IOUtils.readFully(
at java.util.jar.JarFile.getBytes(
at java.util.jar.JarFile.getManifestFromReference(
at java.util.jar.JarFile.getManifest(
at sun.misc.URLClassPath$JarLoader$2.getManifest(
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at com.aspose.cad.internal.fG.k.k(Unknown Source)
at com.aspose.cad.internal.fG.n.a(Unknown Source)
at com.aspose.cad.internal.fG.k.aO(Unknown Source)
at com.aspose.cad.internal.fI.Y.a(Unknown Source)
at com.aspose.cad.internal.fI.Y.e(Unknown Source)
at com.aspose.cad.internal.fG.k.a(Unknown Source)
at com.aspose.cad.internal.fG.bk.a(Unknown Source)
at Source)
at com.aspose.cad.Image.a(Unknown Source)
at com.aspose.cad.Image.load(Unknown Source)
at com.aspose.cad.examples.DWGDrawings.ConvertDWGFileToPDF.main(


Please try using latest Aspose.CAD for Java on your end and also consider increasing the heap size on your end. I hope the heap size increase will resolve the issue.

Is there a recommended setting for heap size? Normally i could see even after changing heapsize setting to -Xmx6G the process is running for indefinite time and failing with the same error.

I am using the 20.4 version. let me check with latest 20.10


Normally 4G to 6G heap size is used but for large files and more complex operations, you have to increase it further.