Convert PowerPoint Presentations to Markdown in C++

Convert PowerPoint to Markdown

  1. Create an instance of the Presentation class to represent a presentation object.
  2. Use the Save method to save the object as a markdown file.

This C++ code shows you how to convert PowerPoint to markdown:

System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(u"pres.pptx");
pres->Save(u"pres.md", SaveFormat::Md);

Convert PowerPoint to Markdown Flavor

Aspose.Slides allows you to convert PowerPoint to markdown (containing basic syntax), CommonMark, GitHub flavored markdown, Trello, XWiki, GitLab, and 17 other markdown flavors.

This C++ code shows you how to convert PowerPoint to CommonMark:

auto pres = System::MakeObject<Presentation>(u"pres.pptx");
auto opt = System::MakeObject<MarkdownSaveOptions>();
opt->set_Flavor(Aspose::Slides::DOM::Export::Markdown::SaveOptions::Flavor::CommonMark);
pres->Save(u"pres.md", Aspose::Slides::Export::SaveFormat::Md, opt);

The 23 supported markdown flavors are listed under the Flavor enumeration from the MarkdownSaveOptions class.

Convert a Presentation Containing Images to Markdown

The MarkdownSaveOptions class provides properties and enumerations that allow you to use certain options or settings for the resulting markdown file. The MarkdownExportType enum, for example, can be set to values that determine how images are rendered or handled: Sequential, TextOnly, Visual.

Convert Images Sequentially

If you want the images to appear individually one after the other in the resulting markdown, you have to choose the sequential option. This C++ code shows you how to convert a presentation containing images to markdown:

System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(u"pres.pptx");

System::SharedPtr<MarkdownSaveOptions> markdownSaveOptions = System::MakeObject<MarkdownSaveOptions>();

markdownSaveOptions->set_ShowHiddenSlides(true);
markdownSaveOptions->set_ShowSlideNumber(true);
markdownSaveOptions->set_Flavor(Flavor::Github);
markdownSaveOptions->set_ExportType(MarkdownExportType::Sequential);
markdownSaveOptions->set_NewLineType(NewLineType::Windows);

pres->Save(u"doc.md", System::MakeArray<int32_t>({1, 2, 3, 4, 5, 6, 7, 8, 9}), SaveFormat::Md, markdownSaveOptions);

Convert Images Visually

If you want the images to appear together in the resulting markdown, you have to choose the visual option. In this case, images will be saved to the current directory of the application (and a relative path will be built for them in the markdown document), or you can specify your preferred path and folder name.

This C++ code demonstrates the operation:

auto pres = System::MakeObject<Presentation>(u"pres.pptx");
const System::String outPath = u"x:\\documents";
auto opt = System::MakeObject<MarkdownSaveOptions>();
opt->set_ExportType(Aspose::Slides::DOM::Export::Markdown::SaveOptions::MarkdownExportType::Visual);
opt->set_ImagesSaveFolderName(u"md-images");
opt->set_BasePath(outPath);
pres->Save(System::IO::Path::Combine(outPath, u"pres.md"), Aspose::Slides::Export::SaveFormat::Md, opt);

FAQ

Do hyperlinks survive the export to Markdown?

Yes. Text hyperlinks are preserved as standard Markdown links. Slide transitions and animations are not converted.

Can I speed up conversion by running it in multiple threads?

You can parallelize across files, but don’t share the same Presentation instance across threads. Use separate instances/processes per file to avoid contention.

What happens to images—where are they saved, and are the paths relative?

Images are exported to a dedicated folder, and the Markdown file references them with relative paths by default. You can configure the base output path and asset folder name to keep a predictable repository structure.