We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem with SlideSizeType set to A4Paper

I am trying to produce my slides in A4 format. My code is like this below:

Dim targetPres As Presentation = New Presentation

If chkA4.Checked Then
targetPres.SlideSizeType = SlideSizeType.A4Paper
End If

’ do some work here and save the file.

I only added the section above to set the SlideSizeType. Everything else is the same as I had originally.

The presentation created using A4 format does not come out right. I am attaching two presentation files for you to examine. The one created by Aspose does not have the right edge position correctly. The presentation does not expand to fill up the slide.

I created the one manually by selecting File => Page setup . . => Select A4 paper as the Slide Size.
You can see in this one, the presentation fills up the whole slide and right edge is in the right position.

Can you take look at the attached files. How can fix this problem?

I am including a simple example to demo this problem. Here is the code. I am attaching an input and output presentation files.

Module Module1

Sub Main()
Dim filename As String = “Input_LetterSize.ppt”
Dim pptFile As String = “…” & filename

Dim pres As Aspose.Slides.Presentation = New Aspose.Slides.Presentation(pptFile)
pres.SlideSizeType = Aspose.Slides.SlideSizeType.A4Paper
End Sub

End Module

Hello Kam,

Setting new value to SlideSizeType doesn’t resize any shapes on slides and masters. That changes slide size only.

So you should resize all objects like background and shapes manually later. The best solution is
create template with resized slides in advance and after that use it with Aspose.Slides.


I see. Using different sized template is one possible solution. However, that would make maintenance more difficult (i.e., two sets of templates to maintain).

It would be really nice if in the future Aspose can provide a feature that would automatically resize all the objects to automatically fit the A4 paper (i.e., mimic the action of the File => Page Setup … of Powerpoint menu. When you do this manually, Powerpoint automatically resizes all the objects to fit the A4 size paper).


I run into a related issue with A4 paper size. When I use Aspose to open a presentation has been previsously saved as A4 paper format (using the File=>Page Setup Powerpoint menu item), it is not rendered properly. If a presentation is already saved as A4 paper format, I would imagine this information is already embedded in the .ppt file.

It doesn't seem that Aspose.Slides utilize this information. i.e., I have to resort to tell users to save the .ppt file as A4 paper format and name the file as XXXXX_A4_Paper. I have to then detect if the file name contains a substring, "A4_Paper". If it does, my code then executes a this statement,

presentation.SlideSizeType = SlideSizeType.A4Paper

This is a hack that I came up with to get around the problem.

If I do all these, then the presentation would be rendered correctly.

The bottom line is, if a .ppt file has already been saved as A4 format, it is reasonable to expect Aspose to automatically handle the paper size format correctly; but it does not. I have to set it manually. Can you make Aspose set the paper size automatically for presenations that have been specified the paper format?


Aspose.Slides uses information from ppt file about slide size and should render “A4” slides properly.
Are you sure you didn’t clone slide to the presentation with “Screen” slide size before rendering?
In case you just open presentation and slide rendered with wrong size then please attach any such ppt here.

The problem seems to lie with the Presentation.CloneSlide(...) method. CloneSlide method does not seem to pickup the original A4 format in the input file. The output file is not rendered correctly. Please see the attached input and output files. Below is the test program I used. Thanks.

Sub Main()
Dim filename As String = "Input_A4.ppt"
Dim pptFile As String = "..\..\" & filename
Dim targetPres As Aspose.Slides.Presentation = New Aspose.Slides.Presentation
Dim srcPres As Aspose.Slides.Presentation = New Aspose.Slides.Presentation(pptFile)

Dim slidePos As Integer
For slidePos = 1 To srcPres.Slides.Count
Dim slide As Aspose.Slides.Slide = srcPres.GetSlideByPosition(slidePos)
srcPres.CloneSlide(slide, targetPres.Slides.LastSlidePosition + 1, _
targetPres, New SortedList())

End Sub

It looks like the SlideSize or SlideSizeType is not stored at the slide level but at the presentation level. I guess the CloneSlide method does not copy information at the presentation level.

If I add one of the statements below before I exit the Main method in the previous example then it will work properly.

targetPres.SlideSizeType = srcPres.SlideSizeType


targetPres.SlideSize = srcPres.SlideSize

Yes, SlideSize can be set to whole presentation only.
MS PowerPoint doesn’t allow to set different sizes for each slide in a presentation.
As a result, cloned slides will always have size which is set in target presentation.
So your target and source presentations should have the same SlideSize for correct cloning and rendering.