Presentation with Image
This guide will demonstrate the process of creating a presentation file with an image using
Before you begin
You should get your API key from your UniCloud account.
If this is your first time using
UniOffice SDK, follow this guide to set up a local development environment.
Clone the project repository
In your terminal, clone the examples repository. It contains the Go code we will be using for this guide.
git clone https://github.com/unidoc/unioffice-examples
To get the example navigate to the path
presentation/image folder in the
How it works
The import section in lines
UniOffice packages and other necessary Go libraries.
init function in lines
14-21, sets the metered license key.
main function in lines
23-60, contains the code that generates the presentation document with an image.
21-31, create new
presentation.Presentation and load two images from file. Then in lines
33-41, the images are added to the presentation using the
Presentation.AddImage method. In line
45, a new slide is created using
ppt.AddSlide(). Then the images and other properties are added to the slide in lines
The presentation is validated in line
56. Finally, it is written to a file using
ppt.SaveToFile("image.pptx") in line
Run the code
Run this command to generate the presentation file.
go run main.go