Skip to content

Commit 6927bc9

Browse files
Modified sample
1 parent 77c2c38 commit 6927bc9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • Images/Extract-EMF-Images-In-PPTX/.NET/Extract-EMF-Images

Images/Extract-EMF-Images-In-PPTX/.NET/Extract-EMF-Images/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using Syncfusion.Presentation;
2-
using System.IO;
2+
using Syncfusion.Drawing;
33

44
public static class Program
55
{
66
public static void Main()
77
{
88
// Open the PowerPoint file as a stream.
9-
using (FileStream inputStream = new FileStream(@"../../../Data/Input.pptx", FileMode.Open, FileAccess.Read))
9+
using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.pptx", FileMode.Open, FileAccess.Read))
1010
{
1111
// Load the presentation from the stream.
1212
using (IPresentation presentation = Presentation.Open(inputStream))
@@ -20,7 +20,7 @@ public static void Main()
2020
foreach (IShape shape in slide.Shapes)
2121
{
2222
// Check if the shape is an image.
23-
if (shape is IPicture picture)
23+
if (shape is IPicture picture && picture.ImageFormat== ImageFormat.Emf)
2424
{
2525
// Retrieve the raw image data.
2626
byte[] imageData = picture.ImageData;
@@ -30,7 +30,7 @@ public static void Main()
3030
{
3131
// Determine the image format extension.
3232
string extension = picture.ImageFormat.ToString();
33-
string outputPath = Path.Combine($"../../../Output/Slide{slide.SlideNumber}_Image{++imageIndex}.{extension}");
33+
string outputPath = Path.Combine($"Output/Slide{slide.SlideNumber}_Image{++imageIndex}.{extension}");
3434
// Save the image data to the specified path.
3535
File.WriteAllBytes(outputPath, imageData);
3636
}

0 commit comments

Comments
 (0)