This is a short example of how to print a Microsoft PowerPoint pptx file to PDF from a c# program. You can easily modify the example to convert other types of documents such as Word or Excel documents.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    // Add the PDF Writer API
    using pdf7.PdfWriter;
    
    namespace PrintPptx
    {
        class Program
        {
            static void Main()
            {
                // Get the name of the printer
                string printerName = PdfUtil.DefaultPrinterName;
    
                // Set printer settings for next print job
                // More settings are available at:
                // https://www.7-pdf.com/products/pdf-printer/documentation/settings
                
                PdfSettings settings = new PdfSettings();
                settings.PrinterName = printerName;
                settings.SetValue("Output", @"C:\Temp\test.pdf");
                settings.SetValue("ShowSettings", "never");
                settings.SetValue("ShowSaveAs", "never");
                settings.SetValue("ShowPDF", "yes");
                settings.SetValue("ConfirmOverwrite", "no");
                settings.SetValue("RememberLastFileName", "no");
                settings.SetValue("RememberLastFolderName", "no");
                settings.SetValue("SuppressErrors", "yes");
                settings.WriteSettings(PdfSettingsFileType.RunOnce);
    
                // Print pptx file requires that Microsoft Powerpoint is installed
                PdfUtil.PrintFile(@"C:\Temp\test.pptx", printerName);
            }
        }
    

Example source files are included in the zip file that can be downloaded here.

Downloads

Attachment Size
Example file 2.2 MB

LiveZilla Live Chat Software
Top