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

Free Support Forum - aspose.cloud

I need help testing Aspose.Words Cloud with trial version

I need help testing Aspose.Words Cloud with trial version.

What I want to do is test ‘words to html’ using cloud sdk for java .
However, a maven dependency exception is thrown.

Please let me know what I am missing.

@pom.xml
Referring to https://repository.aspose.cloud/words/,
Added and .

@ java code
import com.aspose.words.cloud.ApiClient;
import com.aspose.words.cloud.api.WordsApi;
import com.aspose.words.cloud.model.SaveOptionsData;
import com.aspose.words.cloud.model.SaveResponse;
import com.aspose.words.cloud.model.requests.SaveAsRequest;
import com.aspose.words.cloud.model.requests.UploadFileRequest;

String clientId = “####-####-####-####-####”;
String secret = “##################”;
WordsApi wordsApi = new WordsApi(new ApiClient(clientId, secret));

String fileName = “test_multi_pages.docx”;
String format = “html”;
String destName = “Out_test_multi_pages.html”;

// Upload original document to Cloud Storage
wordsApi.uploadFile(new UploadFileRequest(new File(fileName), “”, null));

SaveAsRequest request = new SaveAsRequest(fileName,new SaveOptionsData().saveFormat(format).fileName(destName),null,null,null,null,null);
SaveResponse result = wordsApi.saveAs(request);


@ Q&A

  1. maven cannot read aspose-words-cloud-22.6.0.jar, or a message indicating that it is not a valid ZIP file is output.

  2. As an alternative, download the jar from https://releases.aspose.com/words/java/ to Aspose.Words for Java 22.5 local pc and add the dependency.

  • The downloaded jar has an issue that it cannot be imported because the classes ApiClient, WordsApi, SaveOptionsData etc… do not exist.

@sonaspo85 Your question is related to Cloud version of Aspose.Words. I will move it to the appropriate forum. My colleagues will help you shortly.

@sonaspo85

I have installed the Aspose.Words Cloud SDK for Java in my Maven project as suggested on Aspose Repository page and unable to notice any issue. Please check the following sample code for reference. If you want to get the output document and other resource files in a single folder then you can set ZipOutput to true.

You can not use on-premise Aspose.Words SDK for Java with Aspose.Words Cloud API.

String fileName = "02_pages.docx";
String localFolder = "C:/Temp";		
String destName = "Out_02_pages.html";

// Upload original document to Cloud Storage
wordsApi.uploadFile(new UploadFileRequest(Files.readAllBytes(Paths.get(localFolder+"/"+fileName).toAbsolutePath()), fileName, null));

// Convert DOCX to HTML
HtmlSaveOptionsData requestSaveOptionsData = new HtmlSaveOptionsData();
//requestSaveOptionsData.setZipOutput(true);
requestSaveOptionsData.setFileName(destName);

SaveAsRequest request = new SaveAsRequest(fileName,requestSaveOptionsData,null,null,null,null,null,null);
SaveResponse result = wordsApi.saveAs(request);
System.out.println(result);