Aspose.Slides  for C++

Create, Edit and Convert PowerPoint Presentations with Aspose.Slides for C++

Aspose.Slides for C++ is a library that enables you to work with PowerPoint presentations programmatically. You can create, edit and convert presentations in various formats, such as PPT, PPTX, PPS, ODP, PDF, HTML, SVG, TIFF, XPS, and more. You can also manipulate the content and appearance of slides, shapes, text, images, animations, transitions, charts, tables, and other elements.

  Download Free Trial

Why Choose Aspose.Slides for C++?

Aspose.Slides for C++ offers many advantages over other solutions for PowerPoint automation, such as:

  • Cross-platform compatibility: Aspose.Slides for C++ supports multiple platforms. You can use Aspose.Slides for C++ on Windows, Linux, macOS, and other operating systems.
  • Easy integration and deployment: Aspose.Slides for C++ is a standalone library that does not require Microsoft Office or any other software to be installed on your system. You can easily integrate Aspose.Slides for C++ with your existing applications and deploy it on any server or cloud environment.
  • Powerful features and functionality: Aspose.Slides for C++ provides a rich set of features and functionality for working with PowerPoint presentations, such as creating and modifying slides, adding and editing shapes, text, images, animations, transitions, charts, tables, and other elements, applying themes and layouts, inserting audio and video, exporting and printing presentations, export to video, and much more.
  • High performance and quality: Aspose.Slides for C++ delivers high performance and quality results for processing PowerPoint presentations. You can process thousands of presentations in minutes, without compromising the fidelity and accuracy of the output.
  • Free trial and licensing options: Aspose.Slides for C++ offers a free trial version that you can download and use for 30 days, without any limitations. You can also choose from various licensing options that suit your needs and budget, such as developer, site, OEM, and cloud licenses.

Advanced C++ PowerPoint Processing Library Features

Save the presentation to file or stream

Convert presentations to standard formats

Manage built-in & custom document properties

Password protect presentations

Add, format & manipulate charts

Add, format & manipulate shapes

Add, format & manipulate slides

Add, format & manipulate text

Add, format & manipulate tables

Export presentations to PDF & XPS

Export slides in SVG format

Add images to presentations

Export presentation to video

Add infographics to presentations

Generate presentations from database

Support for MSO 2016 Charts

Export presentations as HTML

Import and export HTML text in slides

Add layout slides to presentations

Load protected presentations

Set Font Size of Individual Legend

Create Stock Chart and Get Chart Image

Change Series Color

Set Chart Area Rounded Borders

Change Color of Categories in Series

Set Font Properties for Chart Data Table

Supported File Formats

Aspose.Slides for C++ can work with a wide range of file formats for PowerPoint presentations, such as:

  • Input formats: PPT, PPTX, PDF, ODP, OTP, POT, POTM, POTX, PPS, PPSM, PPSX, PPTM, FODP, and more.
  • Output formats: PPTX, PPT, PDF, HTML, PNG, BMP, JPG, FODP, GIF, ODP, OTP, POT, POTM, POTX, PPS, PPSM, PPSX, PPTM, SVG, TIFF, and more.

You can also convert presentations to and from streams and byte arrays.

Export Powerpoint files to PDF

Aspose.Slides for C++ is a powerful C++ library for creating and manipulating presentation files. Moreover, it provides flexible ways to convert presentation to PDF. Using Aspose.Slides for C++, any developer or application can convert Powerpoint presentation to PDF file with just a few lines of C++ code.

C++ code for converting presentation to PDF

// Load the PPT.
SharedPtr<Presentation> presentation = MakeObject<Presentation>(u"presentation.ppt");
// Save in PDF format.
presentation->Save(u"document.pdf", Aspose::Slides::Export::SaveFormat::Pdf);

Add animation to presentation

Adding animation to presentation elements can make it more interactive and engaging for viewers.

C++ code for adding animation to TextBox

// Instantiates a presentation class that represents a presentation file.
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>();

System::SharedPtr<ISlide> sld = pres->get_Slides()->idx_get(0);

// Adds new AutoShape with text
System::SharedPtr<IAutoShape> autoShape =
    sld->get_Shapes()->AddAutoShape(Aspose::Slides::ShapeType::Rectangle, 20.0f, 20.0f, 150.0f, 100.0f);

System::SharedPtr<ITextFrame> textFrame = autoShape->get_TextFrame();
textFrame->set_Text(u"First paragraph \nSecond paragraph \n Third paragraph");

// Gets the main sequence of the slide.
System::SharedPtr<ISequence> sequence = sld->get_Timeline()->get_MainSequence();

// Adds Fade animation effect to shape
System::SharedPtr<IEffect> effect = sequence->AddEffect(autoShape, Aspose::Slides::Animation::EffectType::Fade,
    Aspose::Slides::Animation::EffectSubtype::None, Aspose::Slides::Animation::EffectTriggerType::OnClick);

// Animates shape text by 1st level paragraphs
effect->get_TextAnimation()->set_BuildType(Aspose::Slides::Animation::BuildType::ByLevelParagraphs1);

// Save the PPTX file to disk
pres->Save(path + u"AnimText_out.pptx", Aspose::Slides::Export::SaveFormat::Pptx);

Save Powerpoint slides to Images

In certain scenarios, it may be required to transform the entire presentation into a collection of images, which is possible using Aspose.Slides for C++.

Converting a presentation to a set of images can be useful in several ways. For instance, it can help reduce the file size of the presentation, making it easier to share and store. Additionally, it can help ensure that the presentation appears the same way on different devices and platforms. Converting presentations to images can also be helpful when you want to include slides in documents or web pages that don’t support PowerPoint files. Finally, converting presentations to images can be useful when you want to create a video from your presentation.

The C++ code demonstrates how to convert a presentation to JPG images.

C++ code for converting presentation to JPG with custom scale

auto pres = System::MakeObject<Presentation>(u"PowerPoint-Presentation.pptx");

// Defines dimensions
int32_t desiredX = 1200, desiredY = 800;
// Gets scaled values of X and Y
float ScaleX = (float)(1.0 / pres->get_SlideSize()->get_Size().get_Width()) * desiredX;
float ScaleY = (float)(1.0 / pres->get_SlideSize()->get_Size().get_Height()) * desiredY;

for (auto&& sld : pres->get_Slides())
{
    // Creates a full scale image
    System::SharedPtr<System::Drawing::Bitmap> bmp = sld->GetThumbnail(ScaleX, ScaleY);

    // Saves the image to disk in JPEG format
    bmp->Save(System::String::Format(u"Slide_{0}.jpg", sld->get_SlideNumber()),
              System::Drawing::Imaging::ImageFormat::get_Jpeg());
}

Convert presentation to video

Converting PowerPoint presentations to videos can be done using the Aspose.Slides for C++ API

Converting a presentation to a video format can be beneficial in several ways. Firstly, it makes the presentation more accessible to a wider audience, as videos can be played on various devices and platforms without the need for PowerPoint software. Secondly, videos are easier to share than PowerPoint files, as they can be uploaded to video-sharing platforms like YouTube. Thirdly, videos can be embedded in websites and blogs, making it easier to share presentations with a larger audience. Fourthly, videos can be used for training purposes, as they can be paused and rewound to review specific sections of the presentation. Finally, videos can help make presentations more engaging by adding animations, transitions, and background music.

C++ code for converting presentation to video

void OnFrameTick(System::SharedPtr<PresentationPlayer> sender, System::SharedPtr<FrameTickEventArgs> args)
{
    System::String fileName = System::String::Format(u"frame_{0}.png", sender->get_FrameIndex());
    args->GetFrame()->Save(fileName);
}

void Run()
{
    auto presentation = System::MakeObject<Presentation>(u"PowerPoint-Presentation.pptx");

    const int32_t fps = 33;

    auto animationsGenerator = System::MakeObject<PresentationAnimationsGenerator>(presentation);
    auto player = System::MakeObject<PresentationPlayer>(animationsGenerator, fps);
    player->FrameTick += OnFrameTick;
    animationsGenerator->Run(presentation->get_Slides());

    const System::String ffmpegParameters = System::String::Format(
        u"-loglevel {0} -framerate {1} -i {2} -y -c:v {3} -pix_fmt {4} {5}",
        u"warning", m_fps, "frame_%d.png", u"libx264", u"yuv420p", "video.mp4");
    auto ffmpegProcess = System::Diagnostics::Process::Start(u"ffmpeg", ffmpegParameters);
    ffmpegProcess->WaitForExit();
}

Learn More about Aspose.Slides for C++

To learn more about Aspose.Slides and how to use it, you can visit the following pages:

  • Aspose.Slides Product Family : This page provides an overview of Aspose.Slides and its features, benefits, and use cases.
  • Aspose.Slides Documentation : This page contains the detailed documentation and tutorials for Aspose.Slides, covering all the supported platforms, file formats, and functionality.
  • Aspose.Slides Pricing : This page lists the pricing and licensing options for Aspose.Slides, as well as the FAQs and support information.
  • Aspose.Slides Blog : This page contains the latest news, updates, and articles about Aspose.Slides and its related topics.
  • Aspose.Slides Forum : This page is a community platform where you can ask questions, share feedback, and get help from other Aspose.Slides users and developers.
  

Support and Learning Resources