How to convert DOCX to PDF in JAVA with Aspose.Words REST API

Hi,
I am using Aspose.Words Cloud API for doc(x) conversion to PDF without using cloud storage.
The code snippet I am using is as -

import java.io.File;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import com.aspose.words.api.WordsApi;
import com.aspose.words.model.ResponseMessage;

public class ConvertDocumentToFormatExample {

public static void main(String... argc) {
  try{

		WordsApi wordsApi = new WordsApi("MY_API_KEY",
				"MY_SID", false);
		String format = "pdf";
		String outPath = "";
		ResponseMessage apiResponse = wordsApi.PutConvertDocument(format, outPath, new File("path_to_doc_file"));
		if (apiResponse != null && apiResponse.getInputStream() != null) {
			InputStream responseStream = apiResponse.getInputStream();
			final Path destination = Paths.get("output.pdf");
			Files.copy(responseStream, destination, StandardCopyOption.REPLACE_EXISTING);
			System.out.println("conversion completed");
		}

	} catch (Exception e) {
	  e.printStackTrace();
  }
}

}

I am getting error as -
com.aspose.words.client.ApiException: {“Message”:“MIME multipart content is not supported by the operation.”}
at com.aspose.words.client.ApiInvoker.invokeAPI(ApiInvoker.java:262)
at com.aspose.words.api.WordsApi.PutConvertDocument(WordsApi.java:765)
at com.alphasense.docconverter.ConvertDocumentToFormatExample.main(ConvertDocumentToFormatExample.java:21)

Please let me know what is incorrect in my request

@poojard

Thanks for your inquiry. We have tested the scenario and noticed the reported issue with the Aspose.Words for Cloud for Java SDK. We are coordinating with our Cloud team and we will update you our findings soon.

We are sorry for the inconvenience.

Thanks Tilal.

Please update me as soon as you get any updates from SDK team on priority.

@poojard

Thanks for your feedback. Sure, we have logged a ticket SDKDEV-533 with high priority for the issue and will notify you as soon as it is resolved

@poojard

Thanks for your patience. Please note above reported issue SDKDEV-533 has been fixed in Aspose.Words for Cloud for Java SDK 10.8.0. It is pushed to Maven/GitHub as well.

@poojard

Please note since Aspose.Words Cloud 19.4 we have introduced API Version v4.0. It has a more simplified API structure and better memory management than older versions. Please find the updated Java code for DOCX to PDF conversion. Please let us know if you have any questions or suggestions.

// Get Client ID and Client Secret from https://dashboard.aspose.cloud/
WordsApi wordsApi = new WordsApi("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx","xxxxxxxxxxxxxxxxxxxxxxxxxxxx","https://api.aspose.cloud");


try {
	
	ConvertDocumentRequest request = new ConvertDocumentRequest(
            Files.readAllBytes(Paths.get("C:/Temp/Test.docx").toAbsolutePath()),
            "pdf",
            null,
            null,
            null,
            null
        );

        File result = wordsApi.convertDocument(request);
        System.out.println("api request completed...");
        File dest = new File("C:/Temp/Test_java.pdf");
		Files.copy(result.toPath(), dest.toPath(),
		java.nio.file.StandardCopyOption.REPLACE_EXISTING);
			
			
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}

	}