Convert PDF to Microsoft PowerPoint
Aspose.PDF for C++ lets you track the progress of PDF to PPTX conversion.
During PDF to PPTX conversion, the text is rendered as Text where you can select/update it. Please note that in order to convert PDF files to PPTX format, Aspose.PDF provides a class named PptxSaveOptions
. An object of the PptxSaveOptions class is passed as a second argument to the Document.Save(..) method
method. The following code snippet shows the process for converting PDF files into PPTX format.
Simple conversion PDF to PPTX with Aspose.PDF for C++
In order to convert PDF to PPTX, Aspose.PDF for C++ advice to use the following code steps.
- Create an instance of Document class
- Create an instance of PptxSaveOptions class
- Use the Save method of the Document object to save the PDF as PPTX
void ConvertPDFtoPPTX()
{
std::clog << __func__ << ": Start" << std::endl;
// String for path name
String _dataDir("C:\\Samples\\Conversion\\");
// String for file name
String infilename("JSON Fundamenals.pdf");
String outfilename("JSON Fundamenals.pptx");
// Open document
auto document = MakeObject<Document>(_dataDir + infilename);
// Save the output in PPTX format
document->Save(_dataDir + outfilename, SaveFormat::Pptx);
std::clog << __func__ << ": Finish" << std::endl;
}
Convert PDF to PPTX with Slides as Images
In case if you need to convert a searchable PDF to PPTX as images instead of selectable text, Aspose.PDF provides such a feature via Aspose.Pdf.PptxSaveOptions class. To achieve this, set property SlidesAsImages of PptxSaveOptios class to ‘true’ as shown in the following code sample.
void ConvertPDFtoPPTX_SlidesAsImages()
{
std::clog << __func__ << ": Start" << std::endl;
// String for path name
String _dataDir("C:\\Samples\\Conversion\\");
// String for file name
String infilename("JSON Fundamenals.pdf");
String outfilename("JSON Fundamenals.pptx");
// Open document
auto document = MakeObject<Document>(_dataDir + infilename);
auto pptxOptions = MakeObject<PptxSaveOptions>();
pptxOptions->set_SlidesAsImages(true);
// Save the output in PPTX format
document->Save(_dataDir + outfilename, pptxOptions);
std::clog << __func__ << ": Finish" << std::endl;
}
Progress Detail of PPTX Conversion
Aspose.PDF for C++ lets you track the progress of PDF to PPTX conversion. The Aspose.Pdf.PptxSaveOptions class provides CustomProgressHandler property that can be specified to a custom method for tracking the progress of conversion as shown in the following code sample.
void ConvertPDFtoPPTX_ProgressDetailConversion()
{
std::clog << __func__ << ": Start" << std::endl;
// String for path name
String _dataDir("C:\\Samples\\Conversion\\");
// String for file name
String infilename("JSON Fundamenals.pdf");
String outfilename("JSON Fundamenals.pptx");
// Open document
auto document = MakeObject<Document>(_dataDir + infilename);
auto pptxOptions = MakeObject<PptxSaveOptions>();
//pptxOptions->set_SlidesAsImages(true);
//Specify Custom Progress Handler
pptxOptions->set_CustomProgressHandler(ShowProgressOnConsole);
// Save the output in PPTX format
document->Save(_dataDir + outfilename, pptxOptions);
std::clog << __func__ << ": Finish" << std::endl;
}
Following is the custom method for displaying progress conversion.
void ShowProgressOnConsole(SharedPtr<UnifiedSaveOptions::ProgressEventHandlerInfo> eventInfo)
{
switch (eventInfo->EventType)
{
case ProgressEventType::TotalProgress:
std::clog << DateTime::get_Now().get_TimeOfDay() << " - Conversion progress : " << eventInfo->Value << std::endl;
break;
case ProgressEventType::ResultPageCreated:
std::clog << DateTime::get_Now().get_TimeOfDay() << " - Result page's " << eventInfo->Value << " of " << eventInfo->MaxValue << " layout created." << std::endl;
break;
case ProgressEventType::ResultPageSaved:
std::clog << DateTime::get_Now().get_TimeOfDay() << " - Result page's " << eventInfo->Value << " of " << eventInfo->MaxValue << " exported." << std::endl;
break;
case ProgressEventType::SourcePageAnalysed:
std::clog << DateTime::get_Now().get_TimeOfDay() << " - Source page " << eventInfo->Value << " of " << eventInfo->MaxValue << " analyzed." << std::endl;
break;
default:
break;
}
}
Try to convert PDF to PowerPoint online
Aspose.PDF for C++ presents you online free application “PDF to PPTX”, where you may try to investigate the functionality and quality it works.