Exception in loading a CadImage from a MemoryStream

Hello, I’m using Aspose CAD 21.1 and trying to load a CadImage from a MemoryStream, here is my code

MemoryStream ms = new MemoryStream();

netDxf.IO.DxfWriter dxfWriter = new netDxf.IO.DxfWriter();
dxfWriter.Write(ms, exportDXF.dxfDrawing, false);

CadImage image = (CadImage)Aspose.CAD.Image.Load(ms);

The ms variable looks to be ok, but the Aspose.CAD.Image.Load method threw the exception:

Aspose.CAD.CadExceptions.ImageLoadException: 'Image loading failed: Cannot read 6 bytes from the stream.'

Is there a way to load a CadImage from a MemoryStream?
Thanks

@subGm

Can you please share the source file reproducing the issue on your end. Please also first try to set the memory stream position to 0 before loading.

This solved the issue,

Thank you

@subGm

It’s good to know things are resolved on your end.