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>Visual Basic 6>PowerPoint Presentations to JPEG

Converting PowerPoint Presentations to JPEG


'----------------------------------------------------------------------
' 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) Open your project in Microsoft Visual Basic 6.0.
'
' 4) In Visual Basic main menu press "Project->References".
'
' 5) In the list of references check "Universal Document Converter Type Library".
'----------------------------------------------------------------------

Private Sub PrintPowerPointToJPEG(strFilePath As String)

  Dim objUDC As IUDC
  Dim itfPrinter As IUDCPrinter
  Dim itfProfile As IProfile
 
  Dim objPPTApp As Object
  Dim itfPresentation As Object

  Set objUDC = New UDC.APIWrapper
  Set itfPrinter = objUDC.Printers("Universal Document Converter")
  Set itfProfile = itfPrinter.Profile

' Use Universal Document Converter API to change settings of converterd document
  itfProfile.PageSetup.ResolutionX = 300
  itfProfile.PageSetup.ResolutionY = 300
  itfProfile.PageSetup.Orientation = PO_LANDSCAPE
 
  itfProfile.FileFormat.ActualFormat = FMT_JPEG
  itfProfile.FileFormat.JPEG.ColorSpace = CS_TRUECOLOR
  
  itfProfile.Adjustments.Crop.Mode = CRP_AUTO
   
  itfProfile.OutputLocation.Mode = LM_PREDEFINED
  itfProfile.OutputLocation.FolderPath = "C:\Out"
  itfProfile.OutputLocation.FileName = "&[DocName(0)] -- page &[Page(3)].&[ImageType]"
  itfProfile.OutputLocation.OverwriteExistingFile = False
  
  itfProfile.PostProcessing.Mode = PP_OPEN_FOLDER
 
' Run Microsoft PowerPoint as COM-server
  On Error Resume Next
  Set objPPTApp = CreateObject("PowerPoint.Application")

' Open document from file
  Err = 0 ' Clear GetLastError() value
  Set itfPresentation = objPPTApp.Presentations.Open(strFilePath, 1, 1, 0)
  
  If Err = 0 Then
  
  ' Get number of slides in the presentation
    nSlides = itfPresentation.Slides.Count

    If nSlides > 0 Then
    
    ' Print all slides from the presentation
      itfPresentation.PrintOptions.PrintInBackground = 0
      itfPresentation.PrintOptions.ActivePrinter = "Universal Document Converter"
      
      Call itfPresentation.PrintOut
      
    End If
    
    ' Close the presentation
    Call itfPresentation.Close
    Set itfPresentation = Nothing
    
  End If

' Close Microsoft PowerPoint
  Call objPPTApp.Quit
  Set objPPTApp = Nothing

End Sub


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