Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active August 11, 2021 04:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/8c978af9f3f8cd902dff92bea4060aa3 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/8c978af9f3f8cd902dff92bea4060aa3 to your computer and use it in GitHub Desktop.
Print PowerPoint Presentations using C#
// Load the PowerPoint presentation
using (Presentation pres = new Presentation())
{
// Create an object of PrinterSettings and set desired options
PrinterSettings printerSettings = new PrinterSettings();
printerSettings.Copies = 2;
printerSettings.DefaultPageSettings.Landscape = true;
printerSettings.DefaultPageSettings.Margins.Left = 10;
//...etc
// Print presentation
pres.Print(printerSettings);
}
try
{
// Load the presentation
Presentation presentation = new Presentation("presentation.pptx");
// Call the print method to print whole presentation to the desired printer
presentation.Print("Please set your printer name here");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nPlease set printer name as string parameter.");
}
// Load the presentation
Presentation presentation = new Presentation("presentation.pptx");
// Call the print method to print whole presentation with the default printer
presentation.Print();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment