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.NET>Outlook Messages to TIFF

Converting Microsoft Outlook Messages to TIFF


'----------------------------------------------------------------------
' 1) Microsoft Outlook 2000 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 Shared readyFlag As Boolean = False
Private Shared myTimer As New System.Windows.Forms.Timer()

Private Shared Sub TimerEventProcessor(ByVal myObject As Object, ByVal myEventArgs As EventArgs)
' This is the method to run when the timer is raised.

    myTimer.Stop()
    readyFlag = True

End Sub


Private Sub WaitSomeTime(ByVal nSec As Single)

    AddHandler myTimer.Tick, AddressOf TimerEventProcessor
    myTimer.Interval = nSec * 1000
    myTimer.Start()

    While readyFlag = False
      ' Processes all the events in the queue.
        Application.DoEvents()
    End While

End Sub


Private Sub PrintOutlookMsgToTIFF(ByVal strFilePath As String)

    Const olDiscard = 1 ' = Outlook.OlInspectorClose.olDiscard

    Dim objUDC As UDC.IUDC
    Dim itfPrinter As UDC.IUDCPrinter
    Dim itfProfile As UDC.IProfile

    Dim objOutlook As Object
    Dim itfMsg As Object

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

    ' Set Universal Document Converter as default printer, because
    ' Outlook's API interface allow printing only on default printer
    objUDC.DefaultPrinter = "Universal Document Converter"

    ' Use Universal Document Converter API to change settings of converterd document
    itfProfile.FileFormat.ActualFormat = UDC.FormatID.FMT_TIFF
    itfProfile.FileFormat.TIFF.ColorSpace = UDC.ColorSpaceID.CS_BLACKWHITE
    itfProfile.FileFormat.TIFF.Compression = UDC.CompressionID.CMP_CCITTGR4

    itfProfile.OutputLocation.Mode = UDC.LocationModeID.LM_PREDEFINED
    itfProfile.OutputLocation.FolderPath = "C:\Out"

    itfProfile.PostProcessing.Mode = UDC.PostProcessingModeID.PP_OPEN_FOLDER

    ' Open MS Outlook as COM-server
    objOutlook = CreateObject("Outlook.Application")

    ' Open Outlook MSG file
    itfMsg = objOutlook.CreateItemFromTemplate(strFilePath)

    ' And print it on the default printer
    Call itfMsg.PrintOut()

    ' Close opened file
    itfMsg.Close(olDiscard)

    ' Wait until Outlook finished printing process
    WaitSomeTime(5)

    ' Close Outlook application
    Call objOutlook.Quit()
    objOutlook = Nothing

End Sub


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