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

Free Support Forum - aspose.com

Convert DWG to PDF eat 14G memory

When converting a dwg to pdf, it runs forever if I limit the memory to 8G
It will convert success if I enlarge the memory limit to 14G
My question is why it eats so much ram?
Here is the dwg, thanks
https://app.box.com/s/ovamaebkx18wz49ay8p4jkq466tklhub

@wilsonsu,
there are some reasons when software can hang, run for a long time or require a lot of memory. We will investigate your file in scope of CADJAVA-10508.

@wilsonsu,
could you please share the code you use for conversion, we need it to understand the problem better.

It is very simple as follow

CadRasterizationOptions ropt = new CadRasterizationOptions();
ropt.setBackgroundColor(Color.getWhite());
ropt.setPageWidth(1600);
ropt.setPageHeight(1600);

PdfOptions opt = new PdfOptions()
opt.setVectorRasterizationOptions(ropt);

com.aspose.cad.Image img = com.aspose.cad.Image.load(“d:/test/test.dwg”)
img.save(“d:/test/test.pdf”, opt);
img.close()

The total time spent is about 2 minutes
I am using aspose-cad-1.1.0-jdk16.jar

@wilsonsu,
could you please verify if the problem still persists for the last release here?

Hi, Alex, I have test with the latest release aspose-cad-22.1-jdk16.jar
The performance has been improved but still need 7.5GB RAM
Time usage is also 2 minutes
It is great though still needs to be improved.

In addition, I can see there are so many objects in the result PDF
I just wonder can I get in advance how many objects there are in total by cad API ?

@wilsonsu,
Hello. Unfortunately, this is the main reason of such performance and memory consumption. This file contains 117k entities including blocks, that contain other entities. The total quantity of entities for export is about 150k.

Yes, I see in the result PDF,
How can I get in advance how many entities there are in total by calling cad API ?

@wilsonsu,
you can get them via cadImage.getEntities().

Ok, thank you very much.

1 Like

Hi, I have another dwg file and I compare the result between Aspose, AnyConv, PDFTron


For 105039_H709B_S2_14376_1.0.dwg
Aspose: Error,
Anyconv: Error,
PDFTron: success and very fast

For A7-01~21_雨污水分流排水設備.dwg
Aspose: Error,
Anyconv: Success in 2 minutes,
PDFTron: success and very fast

All sample and result pdf files can be found here https://app.box.com/s/mt0hg7648wseyiysvs2jjpaode9jptmr

Please let me know if you have improved the cad to pdf performance .
Thanks

@wilsonsu,
Hello. We have created separate CADJAVA-10553 issue to research possible performance and quality improvements.