Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert PDF to PPT in C#
// Load PDF document
Document pdfDocument = new Document("document.pdf");
PptxSaveOptions pptxOptions = new PptxSaveOptions();
pptxOptions.SlidesAsImages = true;
// Save output file
pdfDocument.Save("PDF to PPT.ppt", pptxOptions);
// Load PDF document
Document pdfDocument = new Document("document.pdf");
PptxSaveOptions pptxOptions = new PptxSaveOptions();
// Render slides as images
pptxOptions.SlidesAsImages = true;
// Track progress in console
pptxOptions.CustomProgressHandler = ShowProgressOnConsole;
// Save output file
pdfDocument.Save("PDF to PPT.ppt", pptxOptions);
//----------------------------------
public static void ShowProgressOnConsole(PptxSaveOptions.ProgressEventHandlerInfo eventInfo)
{
switch (eventInfo.EventType)
{
case ProgressEventType.TotalProgress:
Console.WriteLine(String.Format("{0} - Conversion progress : {1}% .", DateTime.Now.TimeOfDay, eventInfo.Value.ToString()));
break;
case ProgressEventType.ResultPageCreated:
Console.WriteLine(String.Format("{0} - Result page's {1} of {2} layout created.", DateTime.Now.TimeOfDay, eventInfo.Value.ToString(), eventInfo.MaxValue.ToString()));
break;
case ProgressEventType.ResultPageSaved:
Console.WriteLine(String.Format("{0} - Result page {1} of {2} exported.", DateTime.Now.TimeOfDay, eventInfo.Value.ToString(), eventInfo.MaxValue.ToString()));
break;
case ProgressEventType.SourcePageAnalysed:
Console.WriteLine(String.Format("{0} - Source page {1} of {2} analyzed.", DateTime.Now.TimeOfDay, eventInfo.Value.ToString(), eventInfo.MaxValue.ToString()));
break;
default:
break;
}
}
// Load PDF document
Document pdfDocument = new Document("document.pdf");
PptxSaveOptions pptxOptions = new PptxSaveOptions();
// Save output file
pdfDocument.Save("PDF to PPT.ppt", pptxOptions);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.