Articles in this section

How to convert a PowerPoint file to PDF in C#, VB.NET ?

Syncfusion® Essential® PowerPoint is a .NET Presentation library used to create, read, and edit PowerPoint documents. Using this library, you can convert a PowerPoint document to PDF or Image in C# and VB.NET.

 

PowerPoint to PDF conversion in PowerPoint presentation can be achieved by loading powerpoint into PresentationToPDFConverter and then converting the loaded document using Convert method.

 

You can also convert an PowerPoint file to PDF with different converter settings in the Convert method.

 

Steps to convert a PowerPoint file to PDF programmatically:

 

  1. Create a new C# console application project.

 

Create a new C# console application project.

 

  1. Install Syncfusion.PresentationToPdfConverter.Base NuGet package as a reference to your .NET Framework applications from the NuGet.org.

 

 NuGet package as a reference

 

  1. Include following namespaces in the Program.cs file.

 

using Syncfusion.OfficeChartToImageConverter;
using Syncfusion.Pdf;
using Syncfusion.Presentation;
using Syncfusion.PresentationToPdfConverter;

 

Imports Syncfusion
Imports Syncfusion.OfficeChartToImageConverter
Imports Syncfusion.Pdf
Imports Syncfusion.Presentation
Imports Syncfusion.PresentationToPdfConverter

 

  1. Use the below code snippet to Open an existing PowerPoint document and convert it into PDF.

 

//Open a PowerPoint Presentation
IPresentation pptxDoc = Presentation.Open("Sample.pptx");
 
//Create an instance of ChartToImageConverter and assign it to the ChartToImageConverter property
pptxDoc.ChartToImageConverter = new ChartToImageConverter();
 
//Convert the PowerPoint Presentation into PDF document
PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc);
 
//Save the PDF document
pdfDocument.Save(@"Sample.pdf");
 
//Close the PDF document
pdfDocument.Close(true);
 
//Close the Presentation
pptxDoc.Close()

 

'Open a PowerPoint Presentation
Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx")
 
'Create an instance of ChartToImageConverter and assign it to the ChartToImageConverter property
pptxDoc.ChartToImageConverter = New ChartToImageConverter()
 
'Convert the PowerPoint Presentation into PDF document
Dim pdfDocument As PdfDocument = PresentationToPdfConverter.Convert(pptxDoc)
 
'Save the PDF document
pdfDocument.Save("Sample.pdf")
 
'Close the PDF document
pdfDocument.Close(True)
 
'Close the Presentation
pptxDoc.Close()

 

A complete working example to convert an PowerPoint file to PDF can be downloaded from PowerPoint-to-PDF-Conversion.zip

 

Know more about Essential® PowerPoint presentation through the documentation, where you can find supported features like PowerPoint file with slides and charts to  PDF conversion along with PowerPoint to Image conversion.

 

Refer here to explore the rich set of Syncfusion® Essential® PowerPoint features.

 

An online sample link for PowerPoint to PDF conversion.

 

Note:

Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion® license key in your application to use the components without trail message.

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied