Convert HTML to Image in C++

Convert HTML files to images using Aspose.Slides for C++ without Microsoft PowerPoint.

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.

Convert HTML to Image Using C++

To convert HTML to an image, create a Presentation from the HTML file and save each 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();

How to Convert HTML to Image Using Aspose.Slides for C++ API

These are the steps to convert HTML to Image in C++.

  1. Install Aspose.Slides for C++ .

  2. Add a library reference (import the library) to your C++ project.

  3. Open the source HTML file in C++.

  4. Save the result as an image file.

Free Online Converter

Convert presentations and slides online.

Convert HTML to Other Supported Formats

You can also convert HTML and save it to other file formats. See all supported formats below.