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 C#>Outlook Messages to TIFF

Converting Microsoft Outlook Messages to TIFF


//////////////////////////////////////////////////////////////////////////////////////////////////// // This example was designed for using in Microsoft Visual C# from // Microsoft Visual Studio 2003 or above. // // 1. Microsoft Outlook 2000 or above should be installed and activated on your PC. // Microsoft Outlook Express does not have COM interface and cannot be used as COM-server! // // 2. Universal Document Converter 5.2 or above should be installed, too. // // 3. Add references to "Microsoft Outlook 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 Outlook = Microsoft.Office.Interop.Outlook; namespace OutlookToTIFF { class Program { static void OutlookToTIFF(string OutputTemplateFilePath) { //Create a UDC object and get its interfaces IUDC objUDC = new APIWrapper(); IUDCPrinter Printer = objUDC.get_Printers("Universal Document Converter"); IProfile Profile = Printer.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 Profile.FileFormat.ActualFormat = FormatID.FMT_TIFF; Profile.FileFormat.TIFF.ColorSpace = ColorSpaceID.CS_BLACKWHITE; Profile.FileFormat.TIFF.Compression = CompressionID.CMP_CCITTGR4; Profile.OutputLocation.Mode = LocationModeID.LM_PREDEFINED; Profile.OutputLocation.FolderPath = @"C:\UDC Output Files"; Profile.PostProcessing.Mode = PostProcessingModeID.PP_OPEN_FOLDER; //Run Microsoft Outlook as COM-server Outlook.Application OutlookApp = new Outlook.ApplicationClass(); Object Missing = Type.Missing; //This will be passed when ever we don’t want to pass value //Open document from file Outlook.MailItem MailItem = (Outlook.MailItem)OutlookApp.CreateItemFromTemplate(OutputTemplateFilePath, Missing); //And print it on the default printer MailItem.PrintOut(); //Close opened file MailItem.Close(Outlook.OlInspectorClose.olDiscard); //Wait until Outlook finished printing process System.Threading.Thread.Sleep(5000); //Close Outlook application OutlookApp.Quit(); } static void Main(string[] args) { string TemplateFilePath = @"c:\Docs\Test.msg"; OutlookToTIFF(TemplateFilePath); } } }


© fCoder SIA Acerca de fCoder SIA | Mapa del sitio