Merge HTML to Image in C++
Use Aspose.Slides for C++ to combine HTML content and render it as images.
Merge HTML to image using Aspose.Slides
Aspose.Slides for C++
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++
, 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
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 .
Add the library as a reference in your project.
Read the source
HTMLfiles withFile::ReadAllText.Create a
Presentationinstance and import theHTMLcontent withAddFromHtml.Render each slide with
GetImageand save it withImageFormat::Png.
Merge Files Online
Merge presentations, documents, and images online.
Merge other files
You can also combine files in other formats.