How to Convert SVG to DXF in JAVA using Aspose.CAD Cloud API

So I am trying to convert SVG data to DXF data. The live demos on your website give a very good result. I tried the Imaging API already but the cloud API is not working currently for this specific conversion, so I am now trying with the CAD cloud API, but I can’t get it to work for some reason.

Here is the result:
image.png (117.2 KB)
image.png (35.4 KB)
And I also tried with that as a storage name, with the exact same result:
image.png (61.6 KB)

At this point I honestly don’t care how it’s done, could you provide me a working example of how to achieve that conversion with any of your low code cloud APIs? Thank you very much for your time.

@Ancotech

The Aspose.Imaging Cloud API supports SVG to DXF conversion, but I am afraid it is not working as expected at the moment. We are already working on the fix.

Please share the product demo link that works for you. We will look into it and suggest you accordingly.

Both work well for SVG to DXF conversion.

@Ancotech

We are sorry for the inconvenience. We noticed that the GetDrawingSaveAs API method is not working as expected. We have logged a ticket, CADCLOUD-496, for further investigation. Meanwhile, you can use PostDrawingSaveAs API method for SVG to DXF conversion as following.

CadApi cadApi = new CadApi(Client_Secret,Client_ID);

String inputFile = "cs2cpp.svg";
String localFolder="C:/Temp/";
String outputFile= "cs2cpp.dxf";		
String format = "dxf";

File file = new File(localFolder + inputFile);
FileInputStream localInputImageStream = new FileInputStream(file);
byte[] localInputImage = IOUtils.toByteArray(localInputImageStream);

// Convert SVG to DXF
PostDrawingSaveAsRequest request = new PostDrawingSaveAsRequest(localInputImage, format,null,null);
byte[] response = cadApi.postDrawingSaveAs(request);
	    
// Save output to local storage
FileOutputStream fos = new FileOutputStream(localFolder + outputFile);
fos.write(response);
fos.close();
1 Like