Universal Document Converter
Información general
Descargas
Comprar
Tutoriales
Desarrolladores
Soporte técnico
Acerca de fCoder SIA


      Búsqueda en el sitio
   


      Conversiones populares
Adobe PDF a JPEG
Word Document a PDF
Hojas de cálculo Excel a PDF
PowerPoint a JPEG
Diseño Visio a PDF
Diseño AutoCAD a TIFF
Página web a JPEG
Convertir de cálculo Excel a PDF
Convertir DjVu a PDF
Convertir una página web a PDF

      Tutorial de vídeo
Ver el tutorial



Página principal>Developer Solutions>Examples>Delphi>PowerPoint Presentations to JPEG

Converting PowerPoint Presentations to JPEG


//////////////////////////////////////////////////////////////////////////////////////////////////// // This example was designed for using in Delphi 7 or higher. // // 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 "Universal Document Converter Type Library" and "Microsoft PowerPoint XX.0 Object Library" type libraries to the project. // XX is the Microsoft Office version installed on your computer. // // Delphi 7: // Use the Project | Import Type Library menu. // Delphi 2006 or latter: // Use the Component | Import Component menu. // // Clear the "Generate Component Wrapper" checkbox and click the "Create Unit" button (Delphi 7) or // select the "Create Unit" option (Delphi 2006 or latter). // // 4. Notice that the number of Microsoft PowerPoint's method parameters may depend on the Office version. // //////////////////////////////////////////////////////////////////////////////////////////////////// program PowerPointToJPEG; {$APPTYPE CONSOLE} uses SysUtils, Variants, Dialogs, ActiveX, Windows, UDC_TLB, Office_TLB, PowerPoint_TLB; procedure PrintPowerPointToJPEG(PowerPointFilePath: string); var objUDC: IUDC; Printer: IUDCPrinter; Profile: IProfile; PowerPointApp: PowerPointApplication; Presentation: PowerPointPresentation; PrintOptions: PowerPoint_TLB.PrintOptions; begin //Create a UDC object and get its interfaces objUDC := CoAPIWrapper.Create; Printer := objUDC.get_Printers('Universal Document Converter'); Profile := Printer.Profile; //Use Universal Document Converter API to change settings of converterd document Profile.PageSetup.Orientation := PO_LANDSCAPE; Profile.FileFormat.ActualFormat := FMT_JPEG; Profile.FileFormat.JPEG.ColorSpace := CS_TRUECOLOR; Profile.OutputLocation.Mode := 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 := PP_OPEN_FOLDER; //Run Microsoft Excel as COM-server PowerPointApp := CoPowerPointApplication.Create; //Open document from file Presentation := PowerPointApp.Presentations.Open(PowerPointFilePath, msoTrue, msoTrue, msoFalse); //Print all slides from the presentation PrintOptions := Presentation.PrintOptions; PrintOptions.PrintInBackground := msoFalse; PrintOptions.ActivePrinter := 'Universal Document Converter'; Presentation.PrintOut(0, Presentation.Slides.Count, '', 1, msoFalse); //Close the presentation Presentation.Close(); //Close Microsoft PowerPoint PowerPointApp.Quit(); end; var TestFilePath: string; begin TestFilePath := ExtractFilePath(ParamStr(0)) + 'TestFile.ppt'; try CoInitialize(nil); try PrintPowerPointToJPEG(TestFilePath); finally CoUninitialize; end; except on E: Exception do MessageDlg(E.ClassName + ' : ' + E.Message, mtError, [mbOK], 0); end; end.


© 2001-2017 fCoder SIA Acerca de fCoder SIA | Mapa del sitio