Print Presentation C#

Often, you may need to print the PowerPoint presentations programmatically from your web or desktop applications. In order to achieve it, this article covers how to print PowerPoint presentations using C#. Furthermore, you will also learn how to set the desired printer and other printing options dynamically.

C# API to Print PowerPoint PPT - Free Download

In order to print PowerPoint presentations, we will use Aspose.Slides for .NET. It is a presentation manipulation API that lets you create, modify and convert PowerPoint presentations from within your .NET applications. You can either download the API or install it using NuGet.

PM> Install-Package Aspose.Slides.NET

The following are the steps to print a PowerPoint presentation with the default printer using C#.

The following code sample shows how to print a PowerPoint presentation in C#.

You can also specify the printer’s name in order to print a PowerPoint presentation. The following are the steps to print a presentation with a particular printer.

The following C# code sample shows how to print a PowerPoint PPT with a specific printer.

Set PowerPoint Printing Options Dynamically

You can also set the other printing options such as the number of copies, page margins, page orientation, etc. The following are the steps to set different printing options for PowerPoint presentations.

  • Load the PowerPoint presentation using Presentation class.
  • Create an instance of PrinterSettings class and set the desired options such as:
    • PrinterSettings.Copies to set number of copies,
    • PrinterSettings.DefaultPageSettings.Landscape to print slides in landscape orientation,
    • and more.
  • Call the Presentation.Print(PrinterSettings) method and pass PrinterSettings object as its parameter.

The following code sample shows how to set different options for printing PowerPoint presentations in C#.

C# PowerPoint Printing API - Get a Free License

You can use Aspose.Slides for .NET without evaluation limitations by requesting a temporary license.

Conclusion

In this article, you have learned how to print PowerPoint presentations using C#. Furthermore, you have seen how to specify the printer’s name and other printing options. In addition, you can visit the documentation to explore other features of Aspose.Slides for .NET. Also, you can feel free to let us know about your queries via our forum.

See Also