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#>Visio Diagrams to TIFF

Converting Visio Diagrams to TIFF


//////////////////////////////////////////////////////////////////////////////////////////////////// // This example was designed for using in Microsoft Visual C# from // Microsoft Visual Studio 2003 or above. // // 1. Microsoft Visio 2002 or above should be installed and activated on your PC. // // 2. Universal Document Converter 5.2 or above should be installed, too. // // 3. Add references to "Microsoft Visio 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 Visio = Microsoft.Office.Interop.Visio; namespace VisioToTIFF { class Program { static void PrintVisioToTIFF(string VisioFilePath) { //Create a UDC object and get its interfaces IUDC objUDC = new APIWrapper(); IUDCPrinter Printer = objUDC.get_Printers("Universal Document Converter"); IProfile Profile = Printer.Profile; //Use Universal Document Converter API to change settings of converterd document Profile.Load(@"C:\Program Files\Universal Document Converter\UDC Profiles\Drawing to TIFF.xml"); Profile.OutputLocation.Mode = LocationModeID.LM_PREDEFINED; Profile.OutputLocation.FolderPath = @"c:\UDC Output Files"; Profile.PostProcessing.Mode = PostProcessingModeID.PP_OPEN_FOLDER; //Run Microsoft Visio as COM-server Visio.Application VisioApp = new Visio.ApplicationClass(); VisioApp.Visible = true; //Open document from file short Flags = (short)(Visio.VisOpenSaveArgs.visOpenRW | Visio.VisOpenSaveArgs.visOpenDontList | Visio.VisOpenSaveArgs.visOpenMacrosDisabled | Visio.VisOpenSaveArgs.visOpenHidden); Visio.Document Document = VisioApp.Documents.OpenEx(VisioFilePath, Flags); //Change document preferences for scaling it to page Document.PrintCenteredH = true; Document.PrintCenteredV = true; Document.PrintFitOnPages = true; //Print document Document.Printer = "Universal Document Converter"; Document.Print(); //Close document Document.Saved = true; Document.Close(); //Close Visio VisioApp.Quit(); } static void Main(string[] args) { string TestFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFile.vsd"); PrintVisioToTIFF(TestFilePath); } } }


© fCoder SIA Acerca de fCoder SIA | Mapa del sitio