1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | string fileToConvert = @"c:\users\public\test.ppt"; Neevia.docCreator DC = new Neevia.docCreator(); DC.setParameter("DocumentOutputFormat", "PDF"); DC.setParameter("DocumentOutputName", "testPPT_CSHARP"); DC.setParameter("DocumentOutputFolder", @"c:\users\public\"); DC.setParameter("PDFAutoRotatePage", "All"); // This works only with MS Office 2003 Microsoft.Office.Interop.PowerPoint.Application MSPowerPoint = new Microsoft.Office.Interop.PowerPoint.Application(); Microsoft.Office.Interop.PowerPoint.Presentation PPTDoc; PPTDoc = MSPowerPoint.Presentations.Open(fileToConvert, Microsoft.Office.Core.MsoTriState.msoFalse, 0, 0); // This works only with MS Office 2000 and XP // PowerPoint._Application MSPowerPoint = new PowerPoint.Application(); // PowerPoint._Presentation PPTDoc; // PPTDoc = MSPowerPoint.Presentations.Open(fileToConvert,0, 0, 0); string tempFile = DC.getParameter("TempDir") + DC.GUID() + ".ps"; PPTDoc.PrintOptions.PrintInBackground = 0; PPTDoc.PrintOptions.ActivePrinter = "Neevia docCreator"; PPTDoc.PrintOut(0, 9999, tempFile, 1, 0); PPTDoc.Close(); MSPowerPoint.Quit(); MSPowerPoint = null; DC.setInputDocument(tempFile, ""); int RVal = DC.create(); DC.fileDelete(tempFile); DC = null; if (RVal != 0) { MessageBox.Show("Error while creating document!!!"); } else { MessageBox.Show("Done converting !!!"); } |