Aspose.Diagram.Examples.CSharp.Knowledge_Base.SaveDiagramTo_VDX_PDF_JPEG_withVSTO.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run() 
        {
            // ExStart:SaveDiagramTo_VDX_PDF_JPEG_withVSTO
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_KnowledgeBase();

            // Create Visio Application Object
            Visio.Application vsdApp = new Visio.Application();

            // Make Visio Application Invisible
            vsdApp.Visible = false;

            // Create a document object and load a diagram
            Visio.Document vsdDoc = vsdApp.Documents.Open(dataDir + "Drawing1.vsd");

            // Save the VDX diagram
            vsdDoc.SaveAs(dataDir + "SaveDiagramToVDXwithVSTO_out.vdx");

            // Save as PDF file
            vsdDoc.ExportAsFixedFormat(Visio.VisFixedFormatTypes.visFixedFormatPDF,
                dataDir + "SaveDiagramToPDFwithVSTO_out.pdf", Visio.VisDocExIntent.visDocExIntentScreen,
                Visio.VisPrintOutRange.visPrintAll, 1, vsdDoc.Pages.Count, false, true,
                true, true, true, System.Reflection.Missing.Value);

            Visio.Page vsdPage = vsdDoc.Pages[1];

            // Save as JPEG Image
            vsdPage.Export(dataDir + "SaveDiagramToJPGwithVSTO_out.jpg");

            // Quit Visio Object
            vsdApp.Quit();
            // ExEnd:SaveDiagramTo_VDX_PDF_JPEG_withVSTO
        }
    }
SaveDiagramTo_VDX_PDF_JPEG_withVSTO