Universal Document Converter
Informazioni sul prodotto
Scarica
Acquista
Tutorial
Soluzioni per sviluppatori
Servizio di assistenza
Chi è fCoder SIA


      Cerca nel sito
   


      Conversioni più richieste
Da Adobe PDF a JPEG
Da documento Word a PDF
Da foglio di lavoro Excel a PDF
Da PowerPoint a JPEG
Da disegno Visio a PDF
Da disegno AutoCAD a TIFF
Da pagina Web a JPEG
Convertire di lavoro Excel in PDF
Convertire da DjVu in PDF
Pagine Web in PDF



Pagina principale>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 Chi è fCoder SIA | Mappa del sito