Browse our Products

Aspose.Slides for PHP via Java 23.7 Release Notes

KeySummaryCategory
SLIDESPHP-31Use Aspose.Slides for Java 23.7 featuresEnhancement

Public API Changes

Markdown export

The presentation can now be exported in a new format: Markdown. The default export looks like this:

New member of the SaveFormat enum has been added: SaveFormat.Md.

$pres = new Presentation("pres.pptx");
$pres->save("pres.md", SaveFormat::Md);

In this case, the default settings will be used:

  • the export type is MarkdownExportType.TextOnly, which means that only text will be exported (pictures and other things will be omitted).
  • default markdown specification: Flavor.Default.

Different dialects of markdown exports are supported:

  • GitLab
  • Github
  • CommonMark
  • Trello
  • XWiki
  • StackOverflow …and many others.

A new MarkdownSaveOptions class has been added to allow configure options of the resulting Markdown document.

In order to save the markdown to Github flavor you can use this code:

$pres = new Presentation("pres.pptx");
$markdownSaveOptions = new MarkdownSaveOptions();
$markdownSaveOptions->setFlavor(Flavor::Github);
$pres->save("pres.md", SaveFormat::Md, $markdownSaveOptions);

In addition, you can export a presentation with images to markdown. There are two variants of this export:

  • Sequential: render all items separately, one by one.
  • Visual: render all items, items that are grouped will be rendered together.

Example:

$pres = new Presentation("pres.pptx");
$markdownSaveOptions = new MarkdownSaveOptions();
$markdownSaveOptions->setExportType(MarkdownExportType::Visual);
$pres->save("pres.md", SaveFormat::Md, $markdownSaveOptions);

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).

The path and folder name for saving can also be specified via options:

$pres = new Presentation("pres.pptx");
$outPath = "c:/documents/";
$markdownSaveOptions = new MarkdownSaveOptions();
$markdownSaveOptions->setExportType(MarkdownExportType::Visual);
$markdownSaveOptions->setImagesSaveFolderName("md-images");
$markdownSaveOptions->setBasePath($outPath);
$pres->save($outPath . "pres.md", SaveFormat::Md, $markdownSaveOptions);

HTML5 embedded images

Added new properties for Html5Options:

  • EmbedImages
  • OutputPath

With them, when saving in Html5, you can save images externally and the HTML document will use relative references to them.

Example:

$pres = new Presentation("pres.pptx");
$outPath = "c:/documents/";
$options = new Html5Options();
$options->setEmbedImages(false);
$options->setOutputPath($outPath);
$pres->save($outPath . "pres.html", SaveFormat::Html5, $options);