Articles in this section
Category / Section

How to export a PowerPoint presentation file as PDF file in C#, VB.NET?

1 min read

Syncfusion Essential Presentation is a .NET PowerPoint library used to create, open, read, edit, and export PowerPoint presentations. Using this library, you can export a PowerPoint presentation file as a PDF file in C# and VB.NET.

Steps to convert a PowerPoint presentation file as PDF document programmatically:

  1. Create a new C# console application.

  1. Install Syncfusion.Presentation.Base NuGet package to the console application project from nuget.org. For more information about adding a NuGet feed in Visual Studio and installing NuGet packages, refer to documentation.

  1. Install Syncfusion.OfficeChartToImageConverter.WPF NuGet package to the console application project from nuget.org.

  1. Install Syncfusion.PresentationToPdfConverter.Base NuGet package to the console application project from nuget.org.

  1. Include the following namespace in the Program.cs file.
using Syncfusion.Presentation;
using Syncfusion.OfficeChartToImageConverter;
using Syncfusion.Pdf;
using Syncfusion.PresentationToPdfConverter;

 

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

 

  1. Use the following code snippet to convert a PowerPoint presentation file as PDF document.
//Open the PowerPoint Presentation.
IPresentation powerpointDoc = Presentation.Open("Sample.pptx");
 
//Create an instance of ChartToImageConverter and assign it to ChartToImageConverter property of presentation.
powerpointDoc.ChartToImageConverter = new ChartToImageConverter();
 
//Convert the PowerPoint Presentation into PDF document.
PdfDocument pdfDocument = PresentationToPdfConverter.Convert(powerpointDoc);
 
//Save the PDF document.
pdfDocument.Save("Sample.pdf");
 
//Close the PDF document.
pdfDocument.Close(true);
 
//Close the Presentation.
powerpointDoc.Close();

 

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

 

You can download the working sample from Convert-PowerPoint-To-PDF.Zip.

By executing the program, you will get the PowerPoint document as follows.

 

An online sample link to convert a PowerPoint-presentation-to-PDF-document.

Take a moment to peruse the documentation, where you can find other options to format the text with code examples.  Refer here to explore the rich set of Syncfusion Essential Presentation features. Refer here to explore more PowerPoint presentation to PDF conversion options.

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.


Conclusion

I hope you enjoyed learning about how to export a PowerPoint presentation file as PDF file in C#, VB.NET.

You can refer to our WinForms Presentation feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Presentation example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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