// For more code snippets, please https://github.com/aspose-words-cloud/aspose-words-cloud-java try { String clientId = "bb959721-5780-4be6-be35-ff5c3a6aa4a2"; String clientSecret = "4d84d5f6584160cbd91dba1fe145db14"; // if baseUrl is null, WordsApi uses default https://api.aspose.cloud WordsApi wordsApi = new WordsApi(clientId, clientSecret, null); // load word document from local system File file1 = new File("test_multi_pages.docx"); // read the content of input word document byte[] documentStream = Files.readAllBytes(file1.toPath()); // resultant image format String format = "jpg"; // create Document conversion request where we provide resultant file name ConvertDocumentRequest convertRequest = new ConvertDocumentRequest(documentStream,format, "Converted.jpg",null, null, null); // perform word to jpg conversion wordsApi.convertDocument(convertRequest); }catch(Exception ex) { System.out.println(ex); }