Universal Document Converter
製品の概要
ダウンロード
ご購入
チュートリアル
開発者の方へ
サポートサービス
fCoder SIAについて


      サイト検索
   


      Video tutorial
Show tutorial



Main page>Developer Solutions>Examples>Visual C#>PowerPoint Presentations to JPEG

Converting PowerPoint Presentations to JPEG


//////////////////////////////////////////////////////////////////////////////////////////////////// // This example was designed for using in Microsoft Visual C# from // Microsoft Visual Studio 2003 or above. // // 1. Microsoft PowerPoint 97 or above should be installed and activated on your PC. // // 2. Universal Document Converter 5.2 or above should be installed, too. // // 3. Add references to "Microsoft PowerPoint XX.0 Object Library" and "Universal Document Converter Type Library" // using the Project | Add Reference menu > COM tab. // XX is the Microsoft Office version installed on your computer. //////////////////////////////////////////////////////////////////////////////////////////////////// using System; using System.IO; using UDC; using PowerPoint = Microsoft.Office.Interop.PowerPoint; //using PowerPoint; in VS2003 using MSO = Microsoft.Office.Core; namespace PowerPointToJPEG { class Program { static void PowerPointToJPEG(string PowerPointFilePath) { //Create a UDC object and get its interfaces IUDC objUDC = new APIWrapper(); IUDCPrinter Printer = objUDC.get_Printers("Universal Document Converter"); IProfile Profile = Printer.Profile; //Use Universal Document Converter API to change settings of converterd document Profile.PageSetup.Orientation = PageOrientationID.PO_LANDSCAPE; Profile.FileFormat.ActualFormat = FormatID.FMT_JPEG; Profile.FileFormat.JPEG.ColorSpace = ColorSpaceID.CS_TRUECOLOR; Profile.OutputLocation.Mode = LocationModeID.LM_PREDEFINED; Profile.OutputLocation.FolderPath = @"c:\UDC Output Files"; Profile.OutputLocation.FileName = @"&[DocName(0)] -- &[Date(0)] -- &[Time(0)].&[ImageType]"; Profile.OutputLocation.OverwriteExistingFile = false; Profile.PostProcessing.Mode = PostProcessingModeID.PP_OPEN_FOLDER; //Run Microsoft Excel as COM-server PowerPoint.Application PowerPointApp = new PowerPoint.ApplicationClass(); //Open document from file PowerPoint.Presentation Presentation = PowerPointApp.Presentations.Open(PowerPointFilePath, MSO.MsoTriState.msoTrue, MSO.MsoTriState.msoTrue, MSO.MsoTriState.msoFalse); //Print all slides from the presentation PowerPoint.PrintOptions PrintOptions = Presentation.PrintOptions; PrintOptions.PrintInBackground = MSO.MsoTriState.msoFalse; PrintOptions.ActivePrinter = "Universal Document Converter"; Presentation.PrintOut(0, Presentation.Slides.Count, "", 1, MSO.MsoTriState.msoFalse); //Close the presentation Presentation.Close(); //Close Microsoft PowerPoint PowerPointApp.Quit(); } static void Main(string[] args) { string TestFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFile.ppt"); PowerPointToJPEG(TestFilePath); } } }


© fCoder SIA fCoder SIAについて | サイトマップ