public static void Run() { try { //ExStart:ExportOfHiddenVisioPagesToSVG // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Intro(); // load an existing Visio Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); // get a particular page Page page = diagram.Pages.GetPage("Flow 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 + "ExportOfHiddenVisioPagesToSVG_Out.svg", options); //ExEnd:ExportOfHiddenVisioPagesToSVG } catch (System.Exception ex) { System.Console.WriteLine("This example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx."); } }
public static void Run() { // ExStart:UseSVGSaveOptions // The path to the documents directory. string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); // Call the diagram constructor to load diagram from a VSD file Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); SVGSaveOptions options = new SVGSaveOptions(); // Summary: // value or the font is not installed locally, they may appear as a block, // set the DefaultFont such as MingLiu or MS Gothic to show these // characters. options.DefaultFont = "MS Gothic"; // Sets the 0-based index of the first page to render. Default is 0. options.PageIndex = 0; // Set page size PageSize pgSize = new PageSize(PaperSizeFormat.A1); options.PageSize = pgSize; diagram.Save(dataDir + "UseSVGSaveOptions_out.svg", options); // ExEnd:UseSVGSaveOptions }
public static void Run() { try { // ExStart:ExportOfHiddenVisioPagesToSVG // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Intro(); // Load an existing Visio Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); // Get a particular page Page page = diagram.Pages.GetPage("Flow 2"); // Set Visio page visiblity page.PageSheet.PageProps.UIVisibility.Value = BOOL.True; // 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 + "ExportOfHiddenVisioPagesToSVG_out.svg", options); // ExEnd:ExportOfHiddenVisioPagesToSVG } catch (System.Exception ex) { System.Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx."); } }
public static void Run() { //ExStart: 1 string dataDir = RunExamples.GetDataDir_Save(); SVGDocument document = new SVGDocument(dataDir + "complex.svg"); SVGSaveOptions saveOptions = new SVGSaveOptions { VectorizeText = true }; document.Save(dataDir + @"vectorized_text_out.svg", saveOptions); //ExEnd: 1 }
private string ConvertDoc(string fileName, string fileNameWithOutExtension, string filePath, string fileDirectory, string outputType) { string outPath; var saveOpt = GetSaveOptions(outputType.Trim().ToLower()); var diagram = new Aspose.Diagram.Diagram(filePath); if ((diagram.Pages.Count > 1 && IsImage(outputType)) || saveOpt.SaveFileFormat == Aspose.Diagram.SaveFileFormat.HTML) { var zipOutFolder = Path.Combine(fileDirectory, fileNameWithOutExtension).TrimEnd(); var zipOutPath = zipOutFolder + ".zip"; Directory.CreateDirectory(zipOutFolder); if (saveOpt.SaveFileFormat == Aspose.Diagram.SaveFileFormat.HTML) { diagram.Save(Path.Combine(zipOutFolder, fileName), saveOpt.SaveFileFormat); } else { for (int index = 0; index < diagram.Pages.Count; index++) { if (saveOpt.SaveFileFormat == Aspose.Diagram.SaveFileFormat.SVG) { SVGSaveOptions opt = new SVGSaveOptions(); opt.PageIndex = index; diagram.Save(Path.Combine(zipOutFolder, diagram.Pages[index].Name + "." + outputType), opt); } else { ImageSaveOptions opt = new ImageSaveOptions(saveOpt.SaveFileFormat); opt.PageIndex = index; diagram.Save(Path.Combine(zipOutFolder, diagram.Pages[index].Name + "." + outputType), opt); } } } ZipFile.CreateFromDirectory(zipOutFolder, zipOutPath); Directory.Delete(zipOutFolder, true); outPath = zipOutPath; } else { outPath = Path.Combine(fileDirectory, fileName); diagram.Save(outPath, saveOpt.SaveFileFormat); } return(outPath); }
public static void Run() { // ExStart:ConvertVisioWithSelectiveShapes // the path to the documents directory. string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); // call the diagram constructor to load diagram from a VSD file Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); // create an instance SVG save options class SVGSaveOptions options = new SVGSaveOptions(); ShapeCollection shapes = options.Shapes; // get shapes by page index and shape ID, and then add in the shape collection object shapes.Add(diagram.Pages[0].Shapes.GetShape(1)); shapes.Add(diagram.Pages[0].Shapes.GetShape(2)); // save Visio drawing diagram.Save(dataDir + "SelectiveShapes_out.svg", options); // ExEnd:ConvertVisioWithSelectiveShapes }
public static void Run() { try { // ExStart:ExportOfHiddenVisioPagesToSVG // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Intro(); // Load an existing Visio Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); // Get a particular page Page page = diagram.Pages.GetPage("Flow 2"); // Set Visio page visiblity page.PageSheet.PageProps.UIVisibility.Value = UIVisibilityValue.Visible; // Initialize PDF save options SVGSaveOptions options = new SVGSaveOptions(); // Set export option of hidden Visio pages options.ExportHiddenPage = false; // Set export guide shapes options.ExportGuideShapes = false; // Set save format options.SaveFormat = Aspose.Diagram.SaveFileFormat.SVG; // Set SVG fit to view port options.SVGFitToViewPort = true; // Set export element as Rectangle options.ExportElementAsRectTag = true; // Save the Visio diagram diagram.Save(dataDir + "ExportOfHiddenVisioPagesToSVG_out.svg", options); // ExEnd:ExportOfHiddenVisioPagesToSVG } catch (System.Exception ex) { System.Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx."); } }
/// <summary> /// Save diagram. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { using (SaveFileDialog dlg = new SaveFileDialog()) { dlg.Filter = "Visio(*.vdx)|*.vdx" + "|Visio(*.vsx)|*.vsx" + "|Visio(*.vtx)|*.vtx" + "|Image(*.tiff)|*.tiff" + "|Image(*.png)|*.png" + "|Image(*.bmp)|*.bmp" + "|Image(*.jpeg)|*.jpeg" + "|Acrobat Reader(*.pdf)|*.pdf" + "|XPS(*.xps)|*.xps" + "|Image(*.gif)|*.gif" + "|HTML(*.html)|*.html" + "|SVG(*.svg)|*.svg" + "|SWF(*.swf)|*.swf"; if (dlg.ShowDialog() == DialogResult.OK) { string ext = Path.GetExtension(dlg.FileName); switch (ext.ToLower()) { case ".vdx": this.diagram.Save(dlg.FileName, SaveFileFormat.VDX); break; case ".vsx": this.diagram.Save(dlg.FileName, SaveFileFormat.VSX); break; case ".vtx": this.diagram.Save(dlg.FileName, SaveFileFormat.VTX); break; case ".tiff": this.diagram.Save(dlg.FileName, SaveFileFormat.TIFF); break; case ".png": ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG); options.PageIndex = this.cmbPagesNumber.SelectedIndex; this.diagram.Save(dlg.FileName, options); break; case ".bmp": options = new ImageSaveOptions(SaveFileFormat.BMP); options.PageIndex = this.cmbPagesNumber.SelectedIndex; this.diagram.Save(dlg.FileName, options); break; case ".jpeg": options = new ImageSaveOptions(SaveFileFormat.JPEG); options.PageIndex = this.cmbPagesNumber.SelectedIndex; this.diagram.Save(dlg.FileName, options); break; case ".pdf": this.diagram.Save(dlg.FileName, SaveFileFormat.PDF); break; case ".xps": this.diagram.Save(dlg.FileName, SaveFileFormat.XPS); break; case ".gif": options = new ImageSaveOptions(SaveFileFormat.GIF); options.PageIndex = this.cmbPagesNumber.SelectedIndex; this.diagram.Save(dlg.FileName, options); break; case ".html": this.diagram.Save(dlg.FileName, SaveFileFormat.HTML); break; case ".svg": SVGSaveOptions svgOptions = new SVGSaveOptions(); svgOptions.PageIndex = this.cmbPagesNumber.SelectedIndex; this.diagram.Save(dlg.FileName, svgOptions); break; case ".swf": this.diagram.Save(dlg.FileName, SaveFileFormat.SWF); break; default: MessageBox.Show("Not supported format: " + ext); break; } } } }