Convert PDF to PowerPoint in C++
Contents
[
Hide
]
Export PDFs to PPTX with default settings, image-based slides, or a configured image resolution.
Configure the Aspose.PDF for C++ SDK before running these functions. Pass an existing input file and a writable destination path; create any required output directories first. Each function is an independent example, and its options do not carry over to other examples.
Convert PDF to PPTX
Save the document using PptxSaveOptions.
- Open the input PDF as Document.
- Create PptxSaveOptions.
- Save the result with Document::Save(), passing the output path and options.
#include <Aspose.PDF.Cpp/Document.h>
#include <Aspose.PDF.Cpp/PptxSaveOptions.h>
namespace ConvertingExamples
{
using namespace System;
using namespace Aspose::Pdf;
void ConvertPdfToPptx(String inputFile, String outputFile)
{
auto document = MakeObject<Document>(inputFile);
auto options = MakeObject<PptxSaveOptions>();
document->Save(outputFile, options);
}
}
Export slides as images
Set SlidesAsImages to true to export slide content as images.
- Open the input PDF as Document.
- Create PptxSaveOptions.
- Set
SlidesAsImagestotruein PptxSaveOptions. - Save the result with Document::Save(), passing the output path and options.
#include <Aspose.PDF.Cpp/Document.h>
#include <Aspose.PDF.Cpp/PptxSaveOptions.h>
namespace ConvertingExamples
{
using namespace System;
using namespace Aspose::Pdf;
void ConvertPdfToPptxSlidesAsImages(String inputFile, String outputFile)
{
auto document = MakeObject<Document>(inputFile);
auto options = MakeObject<PptxSaveOptions>();
options->set_SlidesAsImages(true);
document->Save(outputFile, options);
}
}
Set PPTX image resolution
Set ImageResolution to 300. This variant does not enable SlidesAsImages.
- Open the input PDF as Document.
- Create PptxSaveOptions.
- Set
ImageResolutionto300in PptxSaveOptions. - Save the result with Document::Save(), passing the output path and options.
#include <Aspose.PDF.Cpp/Document.h>
#include <Aspose.PDF.Cpp/PptxSaveOptions.h>
namespace ConvertingExamples
{
using namespace System;
using namespace Aspose::Pdf;
void ConvertPdfToPptxImageResolution(String inputFile, String outputFile)
{
auto document = MakeObject<Document>(inputFile);
auto options = MakeObject<PptxSaveOptions>();
options->set_ImageResolution(300);
document->Save(outputFile, options);
}
}