Skip to content

Commit 98d004c

Browse files
SLIDESDOC-627 Update article text to improve time to read (#786)
* SLIDESDOC-627 Update article text to improve time to read Updated the text in the article "Format PowerPoint Text in Python". * SLIDESDOC-627 Update article text to improve time to read Updated text and code examples in two articles. * SLIDESDOC-627 Update article text to improve time to read Updated the article "Convert PowerPoint Presentations to Markdown in Python". * SLIDESDOC-627 Update article text to improve time to read Updated the article "Convert PowerPoint Slides to PNG in Python". * SLIDESDOC-627 Update article text to improve time to read Updated the article "Enhance PowerPoint Presentations with Animations in Python". * SLIDESDOC-627 Update article text to improve time to read Updated the article "Manage Shapes in Presentations Using Python". * SLIDESDOC-627 Update article text to improve time to read Updated the article "Enhance Your Presentations with AutoFit in Python". * SLIDESDOC-627 Update article text to improve time to read Updated the article "Manage SmartArt Graphics in Presentations Using Python". * SLIDESDOC-627 Update article text to improve time to read Updated the article "Licensing". * SLIDESDOC-627 Update article text to improve time to read Updated the article "Advanced Text Extraction from PowerPoint Presentations in Python".
1 parent 2d79426 commit 98d004c

File tree

15 files changed

+775
-848
lines changed

15 files changed

+775
-848
lines changed

en/python-net/developer-guide/manage-presentation/convert-presentation/convert-powerpoint/convert-powerpoint-to-markdown/_index.md

Lines changed: 41 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -28,92 +28,80 @@ keywords:
2828
description: "Convert PowerPoint and OpenDocument slides—PPT, PPTX, ODP—to clean Markdown with Aspose.Slides for Python via .NET, automate documentation and keep formatting."
2929
---
3030

31-
{{% alert color="info" %}}
31+
## **Convert Presentations to Markdown**
3232

33-
Support for PowerPoint to markdown conversion was implemented in [Aspose.Slides 23.7](https://docs.aspose.com/slides/python-net/aspose-slides-for-python-net-23-7-release-notes/).
33+
The example below shows the simplest way to convert a PowerPoint presentation to Markdown using Aspose.Slides for Python via .NET with default settings.
3434

35-
{{% /alert %}}
35+
1. Instantiate a [Presentation](https://reference.aspose.com/slides/python-net/aspose.slides/presentation/) to load the presentation.
36+
1. Call `save` to export it as a Markdown file.
3637

37-
{{% alert color="warning" %}}
38-
39-
PowerPoint to markdown export is **without images** by default. If you want to export a PowerPoint document containing images, you need to set `saveOptions.export_type = MarkdownExportType.VISUAL` also set the `base_path` where the images referenced in the markdown document will be saved.
40-
41-
{{% /alert %}}
42-
43-
## **Convert PowerPoint to Markdown**
44-
45-
1. Create an instance of the [Presentation](https://reference.aspose.com/slides/python-net/aspose.slides/presentation/) class to represent a presentation object.
46-
2. Use the [Save](https://reference.aspose.com/slides/python-net/aspose.slides/presentation/#methods) method to save the object as a markdown file.
47-
48-
This Python code shows you how to convert PowerPoint to markdown:
38+
Use the Python snippet below to perform the conversion:
4939

5040
```python
5141
import aspose.slides as slides
5242

53-
with slides.Presentation("pres.pptx") as pres:
54-
pres.save("pres.md", slides.export.SaveFormat.MD)
43+
with slides.Presentation("presentation.pptx") as presentation:
44+
presentation.save("presentation.md", slides.export.SaveFormat.MD)
5545
```
5646

57-
## Convert PowerPoint to Markdown Flavor
47+
## **Convert Presentations to Markdown Flavor**
5848

59-
Aspose.Slides allows you to convert PowerPoint to markdown (containing basic syntax), CommonMark, GitHub flavored markdown, Trello, XWiki, GitLab, and 17 other markdown flavors.
49+
Aspose.Slides allows you to convert presentations to Markdown formats, including basic Markdown, CommonMark, GitHub-flavored Markdown, Trello, XWiki, GitLab, and 17 other Markdown flavors.
6050

61-
This Python code shows you how to convert PowerPoint to CommonMark:
51+
The following Python example shows how to convert a PowerPoint presentation to CommonMark:
6252

6353
```python
64-
from aspose.slides import Presentation
65-
from aspose.slides.dom.export.markdown.saveoptions import MarkdownSaveOptions, Flavor
66-
from aspose.slides.export import SaveFormat
54+
import aspose.slides as slides
6755

68-
with Presentation("pres.pptx") as pres:
69-
saveOptions = MarkdownSaveOptions()
70-
saveOptions.flavor = Flavor.COMMONMARK
56+
save_options = slides.export.MarkdownSaveOptions()
57+
save_options.flavor = slides.export.Flavor.COMMON_MARK
7158

72-
pres.save("pres.md", SaveFormat.MD, saveOptions)
59+
with slides.Presentation("presentation.pptx") as presentation:
60+
presentation.save("presentation.md", slides.export.SaveFormat.MD, save_options)
7361
```
7462

75-
The 23 supported markdown flavors are [listed under the Flavor enumeration](https://reference.aspose.com/slides/python-net/aspose.slides.dom.export.markdown.saveoptions/flavor/) from the [MarkdownSaveOptions](https://reference.aspose.com/slides/python-net/aspose.slides.dom.export.markdown.saveoptions/markdownsaveoptions/) class.
63+
The 23 supported Markdown flavors are listed in the [Flavor](https://reference.aspose.com/slides/python-net/aspose.slides.dom.export.markdown.saveoptions/flavor/) enumeration of the [MarkdownSaveOptions](https://reference.aspose.com/slides/python-net/aspose.slides.dom.export.markdown.saveoptions/markdownsaveoptions/) class.
7664

77-
## **Convert Presentation Containing Images to Markdown**
65+
## **Convert Presentations Containing Images to Markdown**
7866

79-
The [MarkdownSaveOptions](https://reference.aspose.com/slides/python-net/aspose.slides.dom.export.markdown.saveoptions/markdownsaveoptions/) class provides properties and enumerations that allow you to use certain options or settings for the resulting markdown file. The [MarkdownExportType](https://reference.aspose.com/slides/python-net/aspose.slides.dom.export.markdown.saveoptions/markdownexporttype/) enum, for example, can be set to values that determine how images are rendered or handled: `Sequential`, `TextOnly`, `Visual`.
67+
The [MarkdownSaveOptions](https://reference.aspose.com/slides/python-net/aspose.slides.dom.export.markdown.saveoptions/markdownsaveoptions/) class provides properties and enumerations that let you configure the resulting Markdown file. For example, the [MarkdownExportType](https://reference.aspose.com/slides/python-net/aspose.slides.dom.export.markdown.saveoptions/markdownexporttype/) enum controls how images are handled: `SEQUENTIAL`, `TEXT_ONLY`, or `VISUAL`.
8068

8169
### **Convert Images Sequentially**
8270

83-
If you want the images to appear individually one after the other in the resulting markdown, you have to choose the sequential option. This Python code shows you how to convert a presentation containing images to markdown:
71+
If you want images to appear individuallyone after another—in the generated Markdown, choose the `SEQUENTIAL` option. The Python example below shows how to convert a presentation with images to Markdown.
8472

8573
```python
8674
import aspose.slides as slides
8775

88-
with slides.Presentation("pres.pptx") as pres:
89-
markdownSaveOptions = slides.export.MarkdownSaveOptions()
90-
markdownSaveOptions.show_hidden_slides = True
91-
markdownSaveOptions.show_slide_number = True
92-
markdownSaveOptions.flavor = slides.export.Flavor.GITHUB
93-
markdownSaveOptions.export_type = slides.export.MarkdownExportType.SEQUENTIAL
94-
markdownSaveOptions.new_line_type = slides.export.NewLineType.WINDOWS
95-
96-
pres.save("doc.md", [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ], slides.export.SaveFormat.MD, markdownSaveOptions)
76+
save_options = slides.export.MarkdownSaveOptions()
77+
save_options.show_hidden_slides = True
78+
save_options.show_slide_number = True
79+
save_options.flavor = slides.export.Flavor.GITHUB
80+
save_options.export_type = slides.export.MarkdownExportType.SEQUENTIAL
81+
save_options.new_line_type = slides.export.NewLineType.WINDOWS
82+
83+
slide_indices = [1, 3, 5]
84+
85+
with slides.Presentation("presentation.pptx") as presentation:
86+
presentation.save("presentation.md", slide_indices, slides.export.SaveFormat.MD, save_options)
9787
```
9888

9989
### **Convert Images Visually**
10090

101-
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.
91+
If you want the images to appear together in the resulting Markdown, choose the `VISUAL` option. In this mode, images are saved to the application’s current directory (and the Markdown document uses relative paths), or you can specify a custom output path and folder name.
10292

103-
This Python code demonstrates the operation:
93+
The Python example below demonstrates this operation:
10494

10595
```python
106-
from aspose.slides import Presentation
107-
from aspose.slides.dom.export.markdown.saveoptions import MarkdownSaveOptions, MarkdownExportType
108-
from aspose.slides.export import SaveFormat
109-
110-
with Presentation("pres.pptx") as pres:
111-
outPath = "c:\\documents"
96+
import os
97+
import aspose.slides as slides
11298

113-
saveOptions = MarkdownSaveOptions()
114-
saveOptions.export_type = MarkdownExportType.VISUAL
115-
saveOptions.images_save_folder_name = "md-images"
116-
saveOptions.base_path = outPath
99+
save_options = slides.export.MarkdownSaveOptions()
100+
save_options.export_type = slides.export.MarkdownExportType.VISUAL
101+
save_options.images_save_folder_name = "md-images"
102+
save_options.base_path = "c:\\documents"
117103

118-
pres.save(outPath + "\\pres.md", SaveFormat.MD, saveOptions)
104+
with slides.Presentation("presentation.pptx") as presentation:
105+
file_path = os.path.join(save_options.base_path, "presentation.md")
106+
presentation.save(file_path, slides.export.SaveFormat.MD, save_options)
119107
```

en/python-net/developer-guide/manage-presentation/convert-presentation/convert-powerpoint/convert-powerpoint-to-png/_index.md

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,72 +22,68 @@ keywords:
2222
description: "Convert PowerPoint and OpenDocument presentations to high-quality PNG images quickly with Aspose.Slides for Python via .NET, ensuring precise, automated results."
2323
---
2424

25-
## **About PowerPoint to PNG Conversion**
25+
## **Overview**
2626

27-
The PNG (Portable Network Graphics) format is not as popular as JPEG (Joint Photographic Experts Group), but it still very popular.
27+
Aspose.Slides for Python via .NET makes it straightforward to convert PowerPoint presentations to PNG. You load a presentation, iterate through its slides, render each one to a raster image, and save the result as PNG files. This is ideal for generating slide previews, embedding slides in web pages, or producing static assets for downstream processing.
2828

29-
**Use case:** When you have a complex image and size is not an issue, PNG is a better image format than JPEG.
29+
## **Convert Slides to PNG**
3030

31-
{{% alert title="Tip" color="primary" %}} You may want to check out Aspose free **PowerPoint to PNG Converters**: [PPTX to PNG](https://products.aspose.app/slides/conversion/pptx-to-png) and [PPT to PNG](https://products.aspose.app/slides/conversion/ppt-to-png). They are a live implementation of the process described on this page. {{% /alert %}}
32-
33-
## **Convert PowerPoint to PNG**
31+
This section shows the simplest possible example of converting a PowerPoint presentation to PNG images using Aspose.Slides for Python via .NET.
3432

3533
Go through these steps:
3634

3735
1. Instantiate the [Presentation](https://reference.aspose.com/slides/python-net/aspose.slides/presentation/) class.
38-
2. Get the slide object from the [Presentation.Slides](https://reference.aspose.com/slides/python-net/aspose.slides/presentation/) collection under the [ISlide](https://reference.aspose.com/slides/python-net/aspose.slides/islide/) interface.
39-
3. Use a [ISlide.GetImage](https://reference.aspose.com/slides/python-net/aspose.slides/islide/) method to get the thumbnail for each slide.
40-
4. Use the [IPresentation.SaveMethod(String, SaveFormat, ISaveOptions](https://reference.aspose.com/slides/python-net/aspose.slides/ipresentation/) method to save the slide thumbnail to the PNG format.
36+
1. Get a slide from the `Presentation.slides` collection (see the [Slide](https://reference.aspose.com/slides/python-net/aspose.slides/slide/) class).
37+
1. Use the `Slide.get_image` method to generate a thumbnail of the slide.
38+
1. Use the `Presentation.save` method to save the slide thumbnail in PNG format.
4139

42-
This Python code shows you how to convert a PowerPoint presentation to PNG:
40+
This Python code shows how to convert a PowerPoint presentation to PNG:
4341

4442
```py
4543
import aspose.slides as slides
4644

47-
pres = slides.Presentation("pres.pptx")
48-
49-
for index in range(pres.slides.length):
50-
slide = pres.slides[index]
51-
with slide.get_image() as image:
52-
image.save("slide_{i}.png".format(i = index), slides.ImageFormat.PNG)
45+
with slides.Presentation("presentation.pptx") as presentation:
46+
for index, slide in enumerate(presentation.slides):
47+
with slide.get_image() as image:
48+
image.save(f"slide_{index}.png", slides.ImageFormat.PNG)
5349
```
5450

55-
## **Convert PowerPoint to PNG With Custom Dimensions**
51+
## **Convert Slides to PNG with Custom Dimensions**
5652

57-
If you want to obtain PNG files around a certain scale, you can set the values for `desiredX` and `desiredY`, which determine the dimensions of the resulting thumbnail.
53+
To export slides to PNG at a custom scale, call `Slide.get_image` with horizontal and vertical scale factors. These multipliers resize the output relative to the slide’s original dimensions—for example, `2.0` doubles both width and height. Use equal values for `scale_x` and `scale_y` to preserve the aspect ratio.
5854

59-
This code in Python demonstrates the described operation:
55+
This Python code demonstrates the described operation:
6056

6157
```py
6258
import aspose.slides as slides
6359

64-
pres = slides.Presentation("pres.pptx")
60+
scale_x = 2
61+
scale_y = scale_x
6562

66-
scaleX = 2
67-
scaleY = 2
68-
for index in range(pres.slides.length):
69-
slide = pres.slides[index]
70-
with slide.get_image(scaleX, scaleY) as image:
71-
image.save("slide_{index}.png".format(index=index), slides.ImageFormat.PNG)
63+
with slides.Presentation("presentation.pptx") as presentation:
64+
for index, slide in enumerate(presentation.slides):
65+
with slide.get_image(scale_x, scale_y) as image:
66+
image.save(f"slide_{index}.png", slides.ImageFormat.PNG)
7267
```
7368

74-
## **Convert PowerPoint to PNG With Custom Size**
75-
76-
If you want to obtain PNG files around a certain size, you can pass your preferred `width` and `height` arguments for `ImageSize`.
69+
## **Convert Slides to PNG with Custom Size**
7770

78-
This code shows you how to convert a PowerPoint to PNG while specifying the size for the images:
71+
If you want to generate PNG files at a specific size, pass your desired `width` and `height` values. The code below shows how to convert a PowerPoint to PNG while specifying the image size:
7972

8073
```py
8174
import aspose.slides as slides
8275
import aspose.pydrawing as drawing
8376

84-
pres = slides.Presentation(path + "pres.pptx")
85-
8677
size = drawing.Size(960, 720)
8778

88-
for index in range(pres.slides.length):
89-
slide = pres.slides[index]
90-
with slide.get_image(size) as image:
91-
image.save("slide_{index}.png".format(index=index), slides.ImageFormat.PNG)
79+
with slides.Presentation("presentation.pptx") as presentation:
80+
for index, slide in enumerate(presentation.slides):
81+
with slide.get_image(size) as image:
82+
image.save(f"slide_{index}.png", slides.ImageFormat.PNG)
9283
```
9384

85+
{{% alert title="Tip" color="primary" %}}
86+
87+
You may want to try Aspose’s free **PowerPoint-to-PNG converters**[PPTX to PNG](https://products.aspose.app/slides/conversion/pptx-to-png) and [PPT to PNG](https://products.aspose.app/slides/conversion/ppt-to-png). They provide a live implementation of the process described on this page.
88+
89+
{{% /alert %}}

0 commit comments

Comments
 (0)