Asp.net converts ppt documents to pdf and asp. netppt documents pdf
1. Add reference
Using Microsoft. Office. Core;
Using Microsoft. Office. Interop. PowerPoint;
Ii. Conversion Method
C # code Replication
/// <Summary> /// convert a PowerPoint file to a PDF file // </summary> /// <param name = "sourcePath"> source file path </param >/// <param name = "targetPath"> target file path </param> /// <returns> returns true if the file is successfully created, false is returned for failure </returns> public static bool PPTConvertToPDF (string sourcePath, string targetPath) {bool result; PpSaveAsFileType ppSaveAsFileType = PpSaveAsFileType. ppSaveAsPDF; // convert to pdf object missing = Type. missing; Microsoft. office. interop. po WerPoint. applicationClass application = null; Presentation persentation = null; try {application = new Microsoft. office. interop. powerPoint. applicationClass (); persentation = application. presentations. open (sourcePath, MsoTriState. msoTrue, MsoTriState. msoFalse, MsoTriState. msoFalse); if (persentation! = Null) {persentation. SaveAs (targetPath, ppSaveAsFileType, MsoTriState. msoTrue) ;}result = true ;}catch {result = false;} finally {if (persentation! = Null) {persentation. Close (); persentation = null;} if (application! = Null) {application. Quit (); application = null ;}} return result ;}
Iii. Call
OfficeToPdf. PPTToPDF ("d :\\ 12345. Pptx "," d :\\ 12345. Pdf ");