Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aspose-com-gists/b2cf818261ace34590f53c84e1a1d035 to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-gists/b2cf818261ace34590f53c84e1a1d035 to your computer and use it in GitHub Desktop.
Convert PPTX to Markdown with Aspose.Slides for Java
import com.aspose.slides.*;
import java.io.File;
public class PptxToMarkdown {
public static void main(String[] args) {
// Path to the source PPTX file
String sourcePath = "samples/presentation.pptx";
// Path for the generated Markdown file
String outputPath = "output/presentation.md";
// Load temporary license (optional for evaluation)
try {
License lic = new License();
lic.setLicense("Aspose.Slides.lic");
} catch (Exception e) {
System.out.println("License not found, continuing with evaluation mode.");
}
// Load the presentation
try (Presentation pres = new Presentation(sourcePath)) {
// Configure Markdown save options
MarkdownSaveOptions options = new MarkdownSaveOptions();
options.setExportNotes(true); // Include speaker notes
options.setExportEmbeddedImages(true); // Export images as separate files
options.setImageSaveFormat(ImageSaveFormat.PNG); // Image format
// Ensure output directory exists
File outFile = new File(outputPath);
outFile.getParentFile().mkdirs();
// Save as Markdown
pres.save(outputPath, SaveFormat.MARKDOWN, options);
System.out.println("Conversion completed. Markdown saved to " + outputPath);
} catch (Exception ex) {
System.err.println("Error during conversion: " + ex.getMessage());
ex.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment