How to Control Export of Hidden Visio Pages to PDF HTML Image & Other Formats us
This tutorial shows how .NET developers can Control the Export of Hidden Visio Pages on Saving inside .NET applications. Aspose.Diagram for .NET API allows developers to include or exclude hidden Visio pages on saving diagram to PDF, HTML, Image (PNG, JPEG, GIF), SVG, and XPS files. Even they may hide Visio pages using Aspose.Diagram API because it's option is already available through the cell UIVisibility in the page ShapeSheet. Aspose.Diagram for .NET API has the Page class that represents a Visio drawing page. The PageSheet property exposed by the Page class also exposes the page properties. The {{UIVisibility }}field of the page properties allows to hide the page.
//your code here...//Set the Export Option for PDF
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
PdfSaveOptions options = new PdfSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.pdf", options);
// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New PdfSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.pdf"), options)
//Set the Export Option for HTML
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
HTMLSaveOptions options = new HTMLSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.html", options);
// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New HTMLSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.html"), options)
//Set the Export Option for Image
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.JPEG);
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.jpeg", options);
// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New ImageSaveOptions(SaveFileFormat.JPEG)
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.jpeg"), options)
//Set the Export Option for SVG
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
SVGSaveOptions options = new SVGSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.svg", options);
// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New SVGSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.svg"), options)
//Set the Export Option for XPS
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
XPSSaveOptions options = new XPSSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.xps", options);
// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New XPSSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.xps"), options)
Url: http://www.aspose.com/.net/diagram-component.aspx
Language: C# | User: Sheraz Khan | Created: Apr 27, 2016 | Tags: Control Export of Hidden Visio Pages save a diagram to PDF format Visio diagram to HTML format save diagram to HTML format .NET Visio Component C# Visio API Visio diagram to XPS format