You can find detailed information at: [Convert PowerPoint PPTX/PPT to PNG Images using C++][https://blog.aspose.com/2021/07/01/convert-powerpoint-pptx-ppt-to-png-images-using-cpp/]
Last active
September 23, 2021 17:08
-
-
Save aspose-com-gists/0046740d3d811e40fa9a6566be50c906 to your computer and use it in GitHub Desktop.
Convert PowerPoint PPTX/PPT to PNG Images using C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source file path | |
const String sourceFilePath = u"SourceDirectory\\Slides\\SamplePresentation.pptx"; | |
// Load the presentation file | |
auto presentation = System::MakeObject<Presentation>(sourceFilePath); | |
// User defined dimension | |
int desiredX = 1200; | |
int desiredY = 800; | |
// Getting scaled value of X and Y | |
float ScaleX = (float)(1.0 / presentation->get_SlideSize()->get_Size().get_Width()) * desiredX; | |
float ScaleY = (float)(1.0 / presentation->get_SlideSize()->get_Size().get_Height()) * desiredY; | |
// Loop through the slides | |
for (SharedPtr<ISlide> slide : presentation->get_Slides()) | |
{ | |
// Create image of the slide | |
SharedPtr<System::Drawing::Bitmap> bitmap = slide->GetThumbnail(ScaleX, ScaleY); | |
// Save the PNG file | |
bitmap->Save(String::Format(u"OutputDirectory\\PresentationToPng_out_{0}.png", slide->get_SlideNumber()), System::Drawing::Imaging::ImageFormat::get_Png()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment