# Merge HTML to Image in C++

> Merge HTML content and export it as images in C++. Use Aspose.Slides for C++ to combine HTML files and render the result.

Source: https://products.aspose.com/slides/cpp/merger/html-to-image/
Updated: 2026-07-09



## Merge HTML to image using Aspose.Slides

[**Aspose.Slides for C++**](/slides/cpp/) is a C++ API for working with presentation content and related formats. You can import multiple `HTML` files into a `Presentation` and render the merged slides as image files.

## Merge HTML to image in C++

Using [**Aspose.Slides for C++**](/slides/cpp/), you can merge `HTML` content with `AddFromHtml`, render each slide with `GetImage`, and save the images with `ImageFormat::Png`.

### C++ code for merging HTML to image

```cpp
auto firstHtmlText = File::ReadAllText(u"first.html");
auto secondHtmlText = File::ReadAllText(u"second.html");
auto presentation = MakeObject<Presentation>();

presentation->get_Slides()->RemoveAt(0);
presentation->get_Slides()->AddFromHtml(firstHtmlText);
presentation->get_Slides()->AddFromHtml(secondHtmlText);

auto slideCount = presentation->get_Slides()->get_Count();
for (int slideIndex = 0; slideIndex < slideCount; slideIndex++)
{
    auto slide = presentation->get_Slide(slideIndex);
    auto outputFileName = String::Format(u"merged_slide_{0}.png", slideIndex);
    auto image = slide->GetImage(2.0, 2.0);
    image->Save(outputFileName, ImageFormat::Png);
    image->Dispose();
}

presentation->Dispose();
```

## How to merge HTML to image in C++

Install **Aspose.Slides for C++**. See [**Installation**](https://docs.aspose.com/slides/cpp/installation/).

Add the library as a reference in your project.

Read the source `HTML` files with `File::ReadAllText`.

Create a `Presentation` instance and import the `HTML` content with `AddFromHtml`.

Render each slide with `GetImage` and save it with `ImageFormat::Png`.

## Merge other files
