How to Convert Powerpoint (PPT) to PDF in C#

In this tutorial, learn to convert a PowerPoint presentation to a PDF using C# and Iron PDF within Visual Studio 2022. Start by uploading your PowerPoint file to Zamzar, an online tool, to convert it into an HTML file. Once the conversion is complete, download the HTML file, which will be in a zip format, containing all the necessary data. Switch to Visual Studio 2022, where Iron PDF is pre-installed via the NuGet Package Manager. The tutorial demonstrates using the ChromePdfRenderer class from Iron PDF to render the HTML file into a PDF document. Set the paper size to A2 and use a license key to activate Iron PDF's full features. The code then converts the HTML to a PDF and saves it to your file system. Running the project generates a PDF that maintains the PowerPoint's original formatting and responsiveness. The video concludes with an offer for further support if needed, ensuring users can easily recreate the process.

Here is the sample code used in the tutorial:

using System;
using IronPdf;

namespace PPTToPDFConverter
{
    class Program
    {
        static void Main(string[] args)
        {
            // Prompting the user to input the path of the downloaded HTML file
            Console.WriteLine("Please enter the path to the HTML file:");
            string htmlFilePath = Console.ReadLine();

            // Prompting the user to input the desired path and name for the output PDF file
            Console.WriteLine("Please enter the desired path and name for the output PDF:");
            string outputPdfPath = Console.ReadLine();

            // Instantiate the ChromePdfRenderer
            var renderer = new ChromePdfRenderer();

            // Set the paper size for the PDF document
            renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A2;

            // Optionally apply a license key if available
            IronPdf.License.LicenseKey = "YOUR_LICENSE_KEY_HERE"; // Replace with your actual license key

            try
            {
                // Render the PDF from the HTML file
                var pdfDocument = renderer.RenderHtmlFileAsPdf(htmlFilePath);

                // Save the rendered PDF to the specified path
                pdfDocument.SaveAs(outputPdfPath);

                Console.WriteLine("PDF generated successfully. Saved at: " + outputPdfPath);
            }
            catch (Exception ex)
            {
                // Log any errors that occur during the PDF generation process
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
    }
}
using System;
using IronPdf;

namespace PPTToPDFConverter
{
    class Program
    {
        static void Main(string[] args)
        {
            // Prompting the user to input the path of the downloaded HTML file
            Console.WriteLine("Please enter the path to the HTML file:");
            string htmlFilePath = Console.ReadLine();

            // Prompting the user to input the desired path and name for the output PDF file
            Console.WriteLine("Please enter the desired path and name for the output PDF:");
            string outputPdfPath = Console.ReadLine();

            // Instantiate the ChromePdfRenderer
            var renderer = new ChromePdfRenderer();

            // Set the paper size for the PDF document
            renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A2;

            // Optionally apply a license key if available
            IronPdf.License.LicenseKey = "YOUR_LICENSE_KEY_HERE"; // Replace with your actual license key

            try
            {
                // Render the PDF from the HTML file
                var pdfDocument = renderer.RenderHtmlFileAsPdf(htmlFilePath);

                // Save the rendered PDF to the specified path
                pdfDocument.SaveAs(outputPdfPath);

                Console.WriteLine("PDF generated successfully. Saved at: " + outputPdfPath);
            }
            catch (Exception ex)
            {
                // Log any errors that occur during the PDF generation process
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
    }
}
Imports System
Imports IronPdf

Namespace PPTToPDFConverter
	Friend Class Program
		Shared Sub Main(ByVal args() As String)
			' Prompting the user to input the path of the downloaded HTML file
			Console.WriteLine("Please enter the path to the HTML file:")
			Dim htmlFilePath As String = Console.ReadLine()

			' Prompting the user to input the desired path and name for the output PDF file
			Console.WriteLine("Please enter the desired path and name for the output PDF:")
			Dim outputPdfPath As String = Console.ReadLine()

			' Instantiate the ChromePdfRenderer
			Dim renderer = New ChromePdfRenderer()

			' Set the paper size for the PDF document
			renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A2

			' Optionally apply a license key if available
			IronPdf.License.LicenseKey = "YOUR_LICENSE_KEY_HERE" ' Replace with your actual license key

			Try
				' Render the PDF from the HTML file
				Dim pdfDocument = renderer.RenderHtmlFileAsPdf(htmlFilePath)

				' Save the rendered PDF to the specified path
				pdfDocument.SaveAs(outputPdfPath)

				Console.WriteLine("PDF generated successfully. Saved at: " & outputPdfPath)
			Catch ex As Exception
				' Log any errors that occur during the PDF generation process
				Console.WriteLine("An error occurred: " & ex.Message)
			End Try
		End Sub
	End Class
End Namespace
$vbLabelText   $csharpLabel

Key Steps Explained:

  • ChromePdfRenderer: This is a class provided by Iron PDF that uses a Chrome-based rendering engine to convert HTML content into PDF documents reliably.
  • License Key Activation: For full features, include a valid license key (if applicable) to unlock premium options of the Iron PDF library.
  • File Paths: You need to provide correct paths both for the HTML input file and for where you want to save the final PDF output.

Further Reading: How to Convert Powerpoint (PPT) to PDF in C#

Regan Pun
Software Engineer
Regan graduated from the University of Reading, with a BA in Electronic Engineering. Before joining Iron Software, his previous job roles had him laser-focused on single tasks; and what he most enjoys at Iron Software is the spectrum of work he gets to undertake, whether it’s adding value to sales, technical support, product development or marketing. He enjoys understanding the way developers are using the Iron Software library, and using that knowledge to continually improve documentation and develop the products.

Ready to get started? Version: 2025.6 just released

View Licenses >