Convert PowerPoint to PDF in C#
PowerPoint to PDF
Nutrient .NET SDK (formerly GdPicture.NET) offers Office-to-PDF conversion that relies entirely on its own technology. The conversion doesn’t rely on third-party tools such as LibreOffice.
This article explains how to convert PowerPoint files such as PPT or PPTX to PDF.
Creating a PDF from a PowerPoint file
To create a PDF from a PowerPoint file, follow the steps below:
- Create a
GdPictureDocumentConverter
object. - Load the source document by passing its path to the
LoadFromFile
method. Recommended: Specify the source document format with a member of theDocumentFormat
enumeration. - Save the output in a new PDF document with the
SaveAsPDF
method.
The example below creates a PDF document from a PowerPoint file:
using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();// Load the source document.gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.pptx", GdPicture14.DocumentFormat.DocumentFormatPPTX);// Save the output in a new PDF document.gdpictureDocumentConverter.SaveAsPDF(@"C:\temp\output.pdf");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter() ' Load the source document. gdpictureDocumentConverter.LoadFromFile("C:\temp\source.pptx", GdPicture14.DocumentFormat.DocumentFormatPPTX) ' Save the output in a new PDF document. gdpictureDocumentConverter.SaveAsPDF("C:\temp\output.pdf")End Using
Used methods
Related topics