Getting error when trying to convert 'dwg' file to an image

Hello guys,
I am getting the error - “class com.aspose.cad.internal.Exceptions.InvalidOperationException: Exported is not registered for CadImage

When I am running the following code (fileData is an inputStream):

Image image = Image.load(fileData);

// Create an instance of CadRasterizationOptions
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();

// Set page width & height
rasterizationOptions.setPageWidth(1200);
rasterizationOptions.setPageHeight(1200);

// Create an instance of PngOptions for the resultant image
ImageOptionsBase options = new PngOptions();
options.setVectorRasterizationOptions(rasterizationOptions);

// Save result image
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

image.save(outputStream, options);

What could be the issue here?
I am using aspose-cad version 22.7.

Thank you!

@danielgabay,
Hi, could you please attach the initial file so we can reproduce this issue?

1 Like

Uploaded:
truetype.zip (26.5 KB)

Thank you!

@danielgabay,
at the moment I can not reproduce this, here is the result of my conversion with 22.7 (load from file and save to file, not streams) truetype.dwg_java_.png (17.8 KB). Probably, you can create small demo-project for us so we can run it and see the error?

Hello @Oleksii.Gorokhovatskyi,
I created a small demo outside of my company code and everything is working as expected.

My company code is a spring rest-api application, There is a controller which is getting file “MediaType.MULTIPART_FORM_DATA_VALUE” and using it as follows:

MultipartFile -> byte[] -> InputStream -> Load -> save to outputstream (Here exception is thrown).

And on the “image.save(outputStream, options);” the exception is thrown.

Any clues? I am not sure about how to approach this.

Thank you!

@danielgabay,
Hi, I created CADJAVA-10815, we have other issue with spring boot, probably, this one relates to those. We will try to reproduce it again.

1 Like

@Oleksii.Gorokhovatskyi, Ok.
Thank you

1 Like

@danielgabay,
Hi. We need your assistance, could you please try again to make the demo app exactly of the same type you are facing this error with this file? We need to be sure we are talking about the same problem.