Set the Page Size of PowerPoint slide

PPT file format is a vivid and explicit way to present your stuff. Our Spire.Presentation enables you to manipulate PPT files easily and flexibly. Using Spire.Presentation you can generate, modify, convert, render, and print PPT documents without installing Microsoft PowerPoint on your machine. It also enables you to set the page size of PPT slide. Using Spire.Presentation, you can just set the page size with one line of code. Here is how to do so. Hope this document can be helpful for you.

Step 1: Create a PPT document.

Presentation presentation = new Presentation();

Step 2: Set page size type to "Custom".

presentation.SlideSize.Type = SlideSizeType.Custom;

You have to set this before you customize the size of slide.

Step 3: Set page size to (800, 500).

presentation.SlideSize.Size = new SizeF(800, 500);

Step 4: Set slide orientation to "Landscape".

presentation.SlideSize.Orientation = SlideOrienation.Landscape;

Step 5: Add background image and other context to the PPT document.

Step 6: Save the PPT document.

presentation.SaveToFile("PageProperty.pptx", FileFormat.Pptx2010);

Download and install Spire.Presentation for .NET and use below code to set the page size of slide.

Screenshot:

Set the Page Size of PPT slide

Full code:

[C#]
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;
namespace SetPagesize
{
    class Program
    {
        static void Main(string[] args)
        {

            //create PPT document
            Presentation presentation = new Presentation();

            //set the size of slides
            presentation.SlideSize.Type = SlideSizeType.Custom;
            presentation.SlideSize.Size = new SizeF(800, 500);
            presentation.SlideSize.Orientation = SlideOrienation.Landscape;

            //set background Image
            string ImageFile = "bg.png";
            RectangleF rect = new RectangleF(0, 0, presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height);
            presentation.Slides[0].Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect);
            presentation.Slides[0].Shapes[0].Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;

            //append new shape
            IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 70, 300, 300));
            shape.ShapeStyle.LineColor.Color = Color.White;
            shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None;

            //add text to shape
            shape.AppendTextFrame("The sample demonstrates how to set the size of slides.");

            //append new paragraph
            shape.TextFrame.Paragraphs.Append(new TextParagraph());

            //add text to paragraph
            shape.TextFrame.Paragraphs[1].TextRanges.Append(new TextRange("With Spire.Office for .NET, developers can create a wide range of applications. It enables developers to open, create, modify, Convert, Print, View MS Word, Excel, PDF documents. Furthermore, it allows users to export data to popular files such as MS Word/Excel/RTF/Access, PDF, XPS, HTML, XML, Text, CSV, DBF, Clipboard, SYLK, etc."));

            //set the Font
            foreach (TextParagraph para in shape.TextFrame.Paragraphs)
            {
                para.TextRanges[0].LatinFont = new TextFont("Arial Rounded MT Bold");
                para.TextRanges[0].Fill.FillType = FillFormatType.Solid;
                para.TextRanges[0].Fill.SolidColor.Color = Color.Black;
                para.Alignment = TextAlignmentType.Left;
                para.Indent = 35;
            }

            //save the document
            presentation.SaveToFile("PageProperty.pptx", FileFormat.Pptx2010);
            System.Diagnostics.Process.Start("PageProperty.pptx");


        }
    }
}
[VB.NET]
Imports Spire.Presentation
Imports Spire.Presentation.Drawing
Imports System.Drawing
Namespace SetPagesize
	Class Program
		Private Shared Sub Main(args As String())

			'create PPT document
			Dim presentation As New Presentation()

			'set the size of slides
			presentation.SlideSize.Type = SlideSizeType.[Custom]
			presentation.SlideSize.Size = New SizeF(800, 500)
			presentation.SlideSize.Orientation = SlideOrienation.Landscape

			'set background Image
			Dim ImageFile As String = "bg.png"
			Dim rect As New RectangleF(0, 0, presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height)
			presentation.Slides(0).Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect)
			presentation.Slides(0).Shapes(0).Line.FillFormat.SolidFillColor.Color = Color.FloralWhite

			'append new shape
			Dim shape As IAutoShape = presentation.Slides(0).Shapes.AppendShape(ShapeType.Rectangle, New RectangleF(50, 70, 300, 300))
			shape.ShapeStyle.LineColor.Color = Color.White
			shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None

			'add text to shape
			shape.AppendTextFrame("The sample demonstrates how to set the size of slides.")

			'append new paragraph
			shape.TextFrame.Paragraphs.Append(New TextParagraph())

			'add text to paragraph
			shape.TextFrame.Paragraphs(1).TextRanges.Append(New TextRange("With Spire.Office for .NET, developers can create a wide range of applications. It enables developers to open, create, modify, Convert, Print, View MS Word, Excel, PDF documents. Furthermore, it allows users to export data to popular files such as MS Word/Excel/RTF/Access, PDF, XPS, HTML, XML, Text, CSV, DBF, Clipboard, SYLK, etc."))

			'set the Font
			For Each para As TextParagraph In shape.TextFrame.Paragraphs
				para.TextRanges(0).LatinFont = New TextFont("Arial Rounded MT Bold")
				para.TextRanges(0).Fill.FillType = FillFormatType.Solid
				para.TextRanges(0).Fill.SolidColor.Color = Color.Black
				para.Alignment = TextAlignmentType.Left
				para.Indent = 35
			Next

			'save the document
			presentation.SaveToFile("PageProperty.pptx", FileFormat.Pptx2010)
			System.Diagnostics.Process.Start("PageProperty.pptx")


		End Sub
	End Class
End Namespace

If you couldn't successfully use Spire.Presentation, please refer Spire.Presentation Quick Start which can guide you quickly use Spire.Presentation.