Read the complete article on printing PowerPoint presentations using C#: https://blog.aspose.com/2021/08/10/print-powerpoint-presentations-using-csharp/
Last active
August 11, 2021 04:33
-
-
Save aspose-com-gists/8c978af9f3f8cd902dff92bea4060aa3 to your computer and use it in GitHub Desktop.
Print PowerPoint Presentations using C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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