Problem with SlideSizeType set to A4Paper

Last post 02-04-2009, 11:16 AM by alcrus. 8 replies.
Sort Posts: Previous Next
  •  12-17-2008, 10:46 AM 157009

    Problem with SlideSizeType set to A4Paper

    Attachment: Present (inaccessible)
    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?


    Filed under: A4 format;SlideSizeType
     
  •  12-18-2008, 11:48 AM 157219 in reply to 157009

    Re: Problem with SlideSizeType set to A4Paper

    Attachment: Present (inaccessible)
    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
            pres.Write("../../Output_A4.ppt")
        End Sub

    End Module


    Filed under: A4 Paper format
     
  •  12-18-2008, 1:09 PM 157234 in reply to 157219

    Re: Problem with SlideSizeType set to A4Paper

    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.

    Alexey Zhilin
    Team Leader
    Aspose Tyumen Team
    About Us
    Contact Us
     
  •  12-18-2008, 1:21 PM 157238 in reply to 157234

    Re: Problem with SlideSizeType set to A4Paper

    Alexey,

    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).

    Thanks.
    Filed under: A4 Paper format
     
  •  02-03-2009, 3:44 PM 163245 in reply to 157238

    Re: Problem with SlideSizeType set to A4Paper

    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?

     
  •  02-03-2009, 11:15 PM 163269 in reply to 163245

    Re: Problem with SlideSizeType set to A4Paper

    Hello,

    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.

    Alexey Zhilin
    Team Leader
    Aspose Tyumen Team
    About Us
    Contact Us
     
  •  02-04-2009, 8:52 AM 163425 in reply to 163269

    Re: Problem with SlideSizeType set to A4Paper

    Attachment: Present (inaccessible)

    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())
            Next

            targetPres.Write("../../TestOutput_A4.ppt")
        End Sub

    Filed under: A4 paper format
     
  •  02-04-2009, 9:36 AM 163434 in reply to 163425

    Re: Problem with SlideSizeType set to A4Paper

    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

    or

    targetPres.SlideSize = srcPres.SlideSize

    Filed under: A4 paper format
     
  •  02-04-2009, 11:16 AM 163449 in reply to 163434

    Re: Problem with SlideSizeType set to A4Paper

    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.

    Alexey Zhilin
    Team Leader
    Aspose Tyumen Team
    About Us
    Contact Us
     
View as RSS news feed in XML