Here we provide C# code, convert PPT to PDF. Directly upload the code;
To be introduced; version 12.0.0.0;
using System; using ; using ; using ; using ; using ; using ; //Office namespacenamespace OfficeToPdf { //Excel class class PowerPointConverter { //Constructor public PowerPointConverter() { } /// <summary> /// Convert PowerPoint to PDF /// </summary> /// <param name="_lstrInputFile">origin file path</param> /// <param name="_lstrOutFile">pdf file output path</param> /// <returns>true Success</returns> public bool ConverterToPdf(string _lstrInputFile, string _lstrOutFile) { lobjPowerPointApp = null; lobjppt = null; object lobjMissing = ; object lobjSaveChanges = null; try { lobjPowerPointApp = new (); lobjppt = (_lstrInputFile, , , ); (_lstrOutFile, , ); } catch (Exception ex) { //Other log operations; return false; } finally { if (lobjppt != null) { (); (lobjppt); lobjppt = null; } if (lobjPowerPointApp != null) { (); (lobjPowerPointApp); lobjPowerPointApp = null; } //Actively activate the garbage collector, mainly to avoid excessive memory usage when converting documents in large quantities, and the garbage collector is not running all the time! (); (); } return true; } } }
Summarize
The above is the entire content of this article. I hope that the content of this article has certain reference value for your study or work. Thank you for your support. If you want to know more about it, please see the following links