'----------------------------------------------------------------------
' 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.NET.
'
' 4) In Visual Basic main menu press "Project->Add Reference...".
'
' 5) In "Add Reference" window go to "COM" tab and double click into
' "Universal Document Converter Type Library".
'----------------------------------------------------------------------
Private Sub PrintPowerPointToJPEG(ByVal strFilePath As String)
Dim objUDC As UDC.IUDC
Dim itfPrinter As UDC.IUDCPrinter
Dim itfProfile As UDC.IProfile
Dim objPPTApp As ObjectDim itfPresentation As ObjectDim nSlides As Long
objUDC = New UDC.APIWrapper
itfPrinter = objUDC.Printers("Universal Document Converter")
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 = UDC.PageOrientationID.PO_LANDSCAPE
itfProfile.FileFormat.ActualFormat = UDC.FormatID.FMT_JPEG
itfProfile.FileFormat.JPEG.ColorSpace = UDC.ColorSpaceID.CS_TRUECOLOR
itfProfile.Adjustments.Crop.Mode = UDC.CropModeID.CRP_AUTO
itfProfile.OutputLocation.Mode = UDC.LocationModeID.LM_PREDEFINED
itfProfile.OutputLocation.FolderPath = "C:\Out"
itfProfile.OutputLocation.FileName = "&[DocName(0)] -- page &[Page(3)].&[ImageType]"
itfProfile.OutputLocation.OverwriteExistingFile = False
itfProfile.PostProcessing.Mode = UDC.PostProcessingModeID.PP_OPEN_FOLDER
' Run Microsoft PowerPoint as COM-serverOn Error Resume Next
objPPTApp = CreateObject("PowerPoint.Application")
' Open document from file
itfPresentation = objPPTApp.Presentations.Open(strFilePath, 1, 1, 0)
' 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 presentationCall itfPresentation.Close()
itfPresentation = Nothing
' Close Microsoft PowerPointCall objPPTApp.Quit()
objPPTApp = Nothing
End Sub