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

Free Support Forum - aspose.com

Converting .SaveToPdf to .Save

I am trying to export my powerpoint slides to individual PDF documents (one document for each slide), but the .SaveToPdf function comes up with a warning that it is obsolete and I should use the .Save function (which will also work with 2007 decks). How do I rewrite the save I have below to work with the new Save method and export one slide at a time?

Dim pres As New Presentation(strFilename)

For i As Integer = 1 To pres.Slides.Count - 1
'Access a slide using its slide position
Dim oSlide As Slide = pres.GetSlideByPosition(1)
Dim iSlides(0) As Integer
iSlides(0) = i - 1
pres.SaveToPdf(sSlideThumbsPath & pptFileName & "_pdf" & i.ToString("000") & ".pdf", iSlides)
Next i

Dear Sam,

I have modified the code snippet for your ease. Please use the following code snippet to serve your purpose. I have verified the code snippet using Aspose.Slides for .NET 4.3.0. Please share with us, if you still encounter any issue.

Dim TestPres As Presentation = New Presentation("D:\\Aspose Data\\asd.ppt")

Dim arr(1) As Integer

For iPos As Integer = 1 To TestPres.Slides.Count

arr(0) = iPos

TestPres.SaveToPdf("D:\\Aspose Data\\thumbnail\\Pres" + iPos.ToString() + ".pdf", arr)

Next

Thanks and Regards,

It looks like you've misunderstood my question. When I use the SaveToPDF function, it posts the warning:

Warning: 'Public Sub SaveToPdf(fname As String, slides() As Integer)' is obsolete: 'Use Presentation.Save method instead.'

I was looking for .Save equivalent to the .SaveToPDF function.

Does this make sense?

thanks

Sam

Dear Sam,

I regret to inform you that Presentation.Save() equivalent to Presentation.SaveToPDF() is unavailable. By using Presentation.Save(), you will not be able to export individual slide as a separate PDF. For this you may need to develop your own logic in terms of cloning single slide from source presentation to target presentation object and then generating the PDF for that target presentation object. You may need to repeat the step for every single slide in this case, if you wish to use Presentation.Save method. Please share with us if there is still any ambiguity.

Thanks and Regards,

Thank you for your response. I think it's a pity you've removed this functionality, it sounds like I will have to do as your described below, or reconsider using PowerPoint 2007 directly.

thanks!

Sam

Mudassir:

Dear Sam,

I regret to inform you that Presentation.Save() equivalent to Presentation.SaveToPDF() is unavailable. By using Presentation.Save(), you will not be able to export individual slide as a separate PDF. For this you may need to develop your own logic in terms of cloning single slide from source presentation to target presentation object and then generating the PDF for that target presentation object. You may need to repeat the step for every single slide in this case, if you wish to use Presentation.Save method. Please share with us if there is still any ambiguity.

Thanks and Regards,