Created
December 10, 2025 08:44
-
-
Save conholdate-gists/b99c41e059122cdea4d67fba80884437 to your computer and use it in GitHub Desktop.
Convert PPTX to PNG with Conholdate.Total for .NET
This file contains hidden or 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
| using System; | |
| using System.IO; | |
| using Conholdate.Total.Slides; | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| // Path to the source PPTX file | |
| string inputPath = "sample.pptx"; | |
| // Folder where PNG files will be saved | |
| string outputDir = "output"; | |
| Directory.CreateDirectory(outputDir); | |
| // Load the presentation | |
| using (Presentation presentation = new Presentation(inputPath)) | |
| { | |
| // Configure PNG output options | |
| var options = new ImageSaveOptions(SaveFormat.Png) | |
| { | |
| DpiX = 300, // Horizontal DPI | |
| DpiY = 300, // Vertical DPI | |
| CompressionLevel = 9 // Maximum compression | |
| }; | |
| // Iterate through each slide and save as PNG | |
| for (int i = 0; i < presentation.Slides.Count; i++) | |
| { | |
| string outPath = Path.Combine(outputDir, $"slide_{i + 1}.png"); | |
| presentation.Slides[i].Save(outPath, options); | |
| Console.WriteLine($"Saved {outPath}"); | |
| } | |
| } | |
| Console.WriteLine("Conversion completed."); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment