Created
December 16, 2025 10:40
-
-
Save conholdate-gists/426ef8aab90217a6e21c90f11dd23f3c to your computer and use it in GitHub Desktop.
Convert PPTX to Markdown 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; | |
| using Conholdate.Total.Presentation; | |
| using Conholdate.Total.Presentation.Export; | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| // Validate arguments | |
| if (args.Length != 2) | |
| { | |
| Console.WriteLine("Usage: PptxToMarkdown <input.pptx> <output.md>"); | |
| return; | |
| } | |
| string inputPath = args[0]; | |
| string outputPath = args[1]; | |
| try | |
| { | |
| // Load the PPTX file | |
| using (Presentation presentation = new Presentation(inputPath)) | |
| { | |
| // Configure markdown export options | |
| var mdOptions = new MarkdownExportOptions | |
| { | |
| PreserveSlideTitles = true, | |
| ImageExportFormat = ImageExportFormat.Png, | |
| IncludeNotes = true, | |
| EmbedImages = false // set true to embed as base64 | |
| }; | |
| // Perform conversion | |
| string markdown = presentation.Save(mdOptions); | |
| // Write markdown to file | |
| File.WriteAllText(outputPath, markdown); | |
| Console.WriteLine($"Conversion successful. Markdown saved to {outputPath}"); | |
| } | |
| } | |
| catch (PresentationException ex) | |
| { | |
| Console.Error.WriteLine($"Conversion failed: {ex.Message}"); | |
| } | |
| catch (Exception ex) | |
| { | |
| Console.Error.WriteLine($"Unexpected error: {ex.Message}"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment