none
C# VSTO PowerPoint Add-In Save As PDF RRS feed

  • Question

  • Hi, i want to save my presention before i close PowerPoint but as a PDF. How do i use ppSaveAsPDF in ThisAddIn_Shutdown?

    thanks

    Tuesday, May 23, 2017 8:08 AM

All replies

  • Hello,

    ThisAddIn_Shutdown event occurs when the add-in is about to be unloaded.

    I suggest you handle Application.PresentationBeforeClose Event and use Presentation.ExportAsFixedFormat Method to save as PDF.

    E.g.

    private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {
                PPT.Application app = Globals.ThisAddIn.Application;
                app.PresentationBeforeClose += App_PresentationBeforeClose;
            }
    
            private void App_PresentationBeforeClose(PPT.Presentation Pres, ref bool Cancel)
            {
                PPT.Application app = Globals.ThisAddIn.Application;
                PPT.Presentation pre = app.ActivePresentation;
                pre.ExportAsFixedFormat(@"C:\Users\Admin\Desktop\Test.pdf", PPT.PpFixedFormatType.ppFixedFormatTypePDF);
            }
    

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 24, 2017 4:58 AM
    Moderator