Reduce the Size of PowerPoint Presentations with Aspose.Slides for .NET

please help me i work in company that has license . i need to reduce size of PowerPoint files . i need to send by email but it is large size. could write code that you use in demo online

@ahmedecw123,
Welcome to our community!
You can split your large presentation into several parts programmatically. Each part will be a separate presentation. Is this solution right for you? What programming language are you using?

Is this really possible to resize? If yes, please let me know how can I do that? Thank you!

1 Like

thank you for your reply , i use c# . i just want to reduce size .

@ahmedecw123, @MattHenry,
To split your large presentation into several separate parts, you can use the next code example:

var largePresentationPath = "<path_to_a_large_presentation>";
var partFolderPath = "<path_to_an_output_part_folder>";

int maxSlideCount = 10; // <--- specify your maximum slide count for parts here 
var largePresentationName = Path.GetFileNameWithoutExtension(largePresentationPath);

using (var largePresentation = new Presentation(largePresentationPath))
{
    int fullPartCount = largePresentation.Slides.Count / maxSlideCount;
    int lastPartSlideCount = largePresentation.Slides.Count % maxSlideCount;
    int currentSlideIndex = 0;

    for (int partIndex = 0; partIndex < fullPartCount; partIndex++)
    {
        using (var partPresentation = new Presentation())
        {
            partPresentation.Slides.RemoveAt(0);
            for (int slideIndex = 0; slideIndex < maxSlideCount; slideIndex++)
            {
                partPresentation.Slides.AddClone(largePresentation.Slides[currentSlideIndex]);
                currentSlideIndex++;
            }

            var partPresentationName = largePresentationName + $"_part{partIndex + 1}.pptx";
            partPresentation.Save(Path.Combine(partFolderPath, partPresentationName), SaveFormat.Pptx);
        }
    }

    if (lastPartSlideCount > 0)
    {
        // last part
        using (var partPresentation = new Presentation())
        {
            partPresentation.Slides.RemoveAt(0);
            for (int slideIndex = 0; slideIndex < lastPartSlideCount; slideIndex++)
            {
                partPresentation.Slides.AddClone(largePresentation.Slides[currentSlideIndex]);
                currentSlideIndex++;
            }

            var partPresentationName = largePresentationName + $"_part{fullPartCount + 1}.pptx";
            partPresentation.Save(Path.Combine(partFolderPath, partPresentationName), SaveFormat.Pptx);
        }
    }
}
1 Like

thank you so much