Thumbnails are usually small-sized images that show the content of the files and make it easier to scroll through them. Microsoft PowerPoint shows the thumbnails for the slides that make it easy to scroll and open the desired slide. There might be situations where you want to make your own PowerPoint viewer application and want to generate the slide thumbnails dynamically. For such cases, this article will teach you how to generate thumbnails of PowerPoint PPTX or PPT presentations programmatically using C++.
- C++ API for Generating Thumbnails for PowerPoint PPTX/PPT Files
- Generate Thumbnails for PowerPoint PPTX/PPT Files using C++
- Generate Thumbnails with User-Defined Dimensions
C++ API for Generating Thumbnails for PowerPoint PPTX/PPT Files
For generating thumbnails of PowerPoint files, we will use the simple and easy-to-use Aspose.Slides for C++ API. It is a robust API that provides many features that help you create, read, and modify PowerPoint files. The API also provides the ability to generate thumbnails of the PowerPoint files. To begin, you can either install the API through NuGet or download it directly from the Downloads section.
PM> Install-Package Aspose.Slides.Cpp
Generate Thumbnails for PowerPoint PPTX/PPT Files using C++
The following are the steps to generate thumbnails of PowerPoint files using C++.
- Load the PowerPoint file using the Presentation class.
- Loop through the slides of the presentation.
- Generate the thumbnail of each slide using the ISlide->GetThumbnail(float scaleX, float scaleY) method.
- Save the thumbnail image using the Bitmap->Save(const String & filename, const Imaging::ImageFormatPtr & format) method.
The following sample code shows how to generate thumbnails of PowerPoint files using C++.
Generate Thumbnails with User-Defined Dimensions
While generating thumbnails of PowerPoint files, you can also specify the dimensions of the thumbnails according to your requirements. To specify custom dimensions while generating thumbnails, please follow the steps given below.
- Load the PowerPoint file using the Presentation class.
- Set the desired dimensions for the thumbnails.
- Loop through the slides of the presentation.
- Generate the thumbnail of each slide using the ISlide->GetThumbnail(float scaleX, float scaleY) method.
- Save the thumbnail image using the Bitmap->Save(const String & filename, const Imaging::ImageFormatPtr & format) method.
The following sample code shows how to generate thumbnails with custom dimensions using C++.
Get a Free License
In order to try the API without evaluation limitations, you can request a free temporary license.
Conclusion
In this article, you have learned how to generate thumbnails for PowerPoint PPTX/PPT files using C++. Furthermore, you have seen how to generate thumbnails with custom dimensions. To learn more about the features provided by the Aspose.Slides for C++ API, you can visit the official documentation. In case of any questions, please feel free to reach us at our free support forum.