In our previous blog post, we went through how to convert VSDX files to PDF and PNG programmatically in the Node.js application. However, this article will go through the steps and the code snippet to convert Visio to SVG or Visio to HTML in Node.js. This Visio Node.js library enables you to edit, create and convert VSDX files to another file format easily and quickly. Further, you may save your diagram as a web page to embed in your business websites.
The following points shall be covered in this blog post:
- Convert Visio to SVG using Node.js
- Node.js library to convert VSDX or Visio to HTML
- Convert Visio to SVG or Visio to HTML in Node.js - advance options
Convert Visio to SVG using Node.js
In this section, we will learn how to convert VSDX or VSD file to SVG programmatically by writing a few lines of source code. You may visit this article to know about the installation of this API.
The following steps will be performed:
- Invoke the Diagram() constructor to load a VSDX file.
- Initialize a new instance of SVGSaveOptions() to specify additional options.
- Call setSVGFitToViewPort(true) method that will make the generated SVG fit to viewport.
- Use this setExportElementAsRectTag(true) method to set export element as Rectangle.
- save(filename, format) method to save the file in SVG format.
Copy and paste the following code snippet into your file.
Node.js library to convert VSDX or Visio to HTML
We will follow the steps mentioned below to convert the VSDX file to a web page:
- Initialize the Diagram() constructor to load a VSDX file.
- Instantiate a new instance of HTMLSaveOptions() to define additional options.
- Call this setTitle(string) method to set the title of the HTML document.
- setSaveToolBar(true) will specify whether to include the toolbar or not.
- Invoke setDefaultFont(string) method to set the font.
- save(filename, format) method to save the file in HTML format.
The following code snippet converts a Visio diagram to a HTML file.
Convert Visio to SVG or Visio to HTML in Node.js - advance options
In addition, this Node.js Diagram library also provides many features related to HTML and SVG file formats. However, you may find the code snippets also that demonstrate the usage of the methods.
Get a Free License
Please try the API beyond evaluation limitations by requesting a free temporary license.
This brings us to end this blog post. We have gone through some interesting points that include converting Visio to SVG and Visio to HTML in Node.js application. This blog post will really help you if you are looking to integrate Aspose.Diagram library to convert VSDX files to other popular file formats. In addition, you may explore the documentation for further features. Moreover, conholdate.com is continuously writing new articles. Therefore, please stay connected for the latest updates.
Ask a question
You can share your questions or queries on our forum.