This article guides on how to replace picture in PowerPoint with Java REST API. You will learn how to replace picture in PowerPoint with Java REST Interface using the Java-based Cloud SDK. It will provide complete details to upload the source files and download the modified files from the Cloud storage.
Prerequisite
- Create an account API credentials
- Download Aspose.Slides Cloud SDK for Dotnet to replace an image
- Setup Java project with the above SDK for replacing a picture
Steps to Replace Image in PPT with Java Java-based API
- Initialize the SlidesApi class object to replace the picture
- Upload the target presentation with some images in it for replacement
- Load the source image into a Stream object to add it to the presentation
- Invoke the ReplaceImage() method by providing the presentation name, target image index, and new image stream
- Download the modified presentation with a new image
The steps describe how to replace picture in PowerPoint with Java REST Interface. Upload the source presentation to the Cloud storage, read the desired image into the Stream object, and call the ReplaceImage() method with the required arguments. Subsequently, call the DownloadFile method to fetch the updated presentation.
Code to Replace Picture in PPT with Java REST API
This code has demonstrated how to change picture shape in PowerPoint with Java RESTful Service. If you do not upload the presentation file to the Cloud storage, it will use any available presentation with the same name from the Cloud storage. You may get different results if you use the existing file name from the Cloud storage uploaded earlier in some other session.
This article has taught us the process of replacing an image in a presentation. To add a new picture, refer to the article on Add Picture to PowerPoint with Java REST API.