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

Converting Visio Diagrams to TIFF


//////////////////////////////////////////////////////////////////////////////////////////////////// // This example was designed for using in Delphi 7 or higher. // // 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 "Universal Document Converter Type Library" and "Microsoft Visio XX.0 Object Library" type libraries to the project. // XX is the Microsoft Office version installed on your computer. // // Delphi 7: // Use the Project | Import Type Library menu. // Delphi 2006 or latter: // Use the Component | Import Component menu. // // Clear the "Generate Component Wrapper" checkbox and click the "Create Unit" button (Delphi 7) or // select the "Create Unit" option (Delphi 2006 or latter). // // 4. Notice that the number of Microsoft Visio's method parameters may depend on the Office version. // //////////////////////////////////////////////////////////////////////////////////////////////////// program VisioToTIFF; {$APPTYPE CONSOLE} uses SysUtils, Variants, Windows, Dialogs, ActiveX, UDC_TLB, Visio_TLB; procedure PrintVisioToTIFF(VisioFilePath: string); var objUDC: IUDC; Printer: IUDCPrinter; Profile: IProfile; VisioApp: IVApplication; Document: IVDocument; Flags: SmallInt; begin //Create a UDC object and get its interfaces objUDC := CoAPIWrapper.Create; Printer := objUDC.get_Printers('Universal Document Converter'); 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 := LM_PREDEFINED; Profile.OutputLocation.FolderPath := 'c:\UDC Output Files'; Profile.PostProcessing.Mode := PP_OPEN_FOLDER; //Run Microsoft Visio as COM-server VisioApp := CoVisioApplication.Create; VisioApp.Visible := True; //Open document from file Flags := visOpenRW or visOpenDontList or visOpenMacrosDisabled or visOpenHidden; 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(); end; var TestFilePath: string; begin TestFilePath := ExtractFilePath(ParamStr(0)) + 'TestFile.vsd'; try CoInitialize(nil); try PrintVisioToTIFF(TestFilePath); finally CoUninitialize; end; except on E: Exception do MessageDlg(E.ClassName + ' : ' + E.Message, mtError, [mbOK], 0); end; end.


© fCoder SIA Chi è fCoder SIA | Mappa del sito