Convert HTML to Image in C++
Convert HTML files to images using Aspose.Slides for C++ without Microsoft PowerPoint.
Convert HTML to Image Using C++
To convert HTML to an image, create a new Presentation, remove its default slide, import the HTML content with AddFromHtml, and save each resulting slide as an image.
C++ code for converting HTML into Image
auto presentation = MakeObject<Presentation>();
presentation->get_Slides()->RemoveAt(0);
auto htmlStream = File::OpenRead(u"page.html");
presentation->get_Slides()->AddFromHtml(htmlStream);
htmlStream->Dispose();
auto slideCount = presentation->get_Slides()->get_Count();
for (int index = 0; index < slideCount; index++)
{
auto slide = presentation->get_Slide(index);
auto fileName = String::Format(u"slide_{0}.png", index);
auto image = slide->GetImage();
image->Save(fileName);
image->Dispose();
}
presentation->Dispose();Convert HTML to Image in C++
Aspose.Slides for C++ is a presentation processing API that can import HTML content and render slides as image files.
Aspose.Slides for C++ can convert HTML content to image formats and other presentation-related formats.
How to Convert HTML to Image Using Aspose.Slides for C++ API
These are the steps to convert HTML to Image in C++.
- Install Aspose.Slides for C++.
- Add a library reference (import the library) to your C++ project.
- Open the source HTML file in C++.
- Save the result as an image file.
Built with Aspose.Slides
Convert HTML to Image Online
The free Aspose.Slides Conversion app is built with Aspose.Slides for C++, the same API as the code above. Open it and see what the API can do with your own HTML files.
- Runs in your browser, nothing to install.
- See how Aspose.Slides converts files before you write code.
- Upload HTML files and save them as Image.
- Download the result or convert more files.
Convert HTML to Other Supported Formats
You can also convert HTML and save it to other file formats. See all supported formats below.