Convert Visio to PDF PNG JPEG SVG HTML XAML in Node.Js

In my previous post, I have demonstrated how to create MS Visio diagrams from scratch in Node.js applications. In this article, I’ll show you how to use Aspose.Diagram to export or convert MS Visio diagrams to various popular file formats in Node.js applications.

The conversion of Visio diagrams could be useful in various scenarios. You can convert a diagram to HTML or JPEG/PNG image to display it on a web page or in a Visio document viewer. Similarly, Visio to PDF conversion could be used to remove the dependency of dedicated software for viewing the diagrams. For such scenarios, Aspose.Diagram provides high-quality conversion of Visio diagrams to other formats.

Node.js Visio Converter API - Installation

You can install Aspose.Diagram into your Node.js application using the following npm command.

npm install aspose.diagram --save

Convert Visio to PDF in Node.js

PDF is a platform-independent document format that keeps the content of a document stable among the heterogeneous environments. Therefore, it is more suitable to convert a Visio diagram to PDF before sharing it among the people without worrying about their environment or installing dedicated software. The following are the steps to convert a Visio diagram to PDF document using Aspose.Diagram.

The following code sample shows how to convert a Visio VSDX to PDF in Node.js.

VSDX File

VSDX to PDF

PDF File

Visio to PDF in Node.js

Convert Visio to PNG/JPEG/Other Images in Node.js

Conversion of Visio diagrams to image formats is useful for generating thumbnails or displaying the content of the diagrams, i.e. for a Visio viewer. Aspose.Diagram lets you convert Visio diagrams to the following image formats:

  • PNG
  • JPEG
  • TIFF
  • BMP
  • EMF

The following are the steps to convert Visio diagrams to PNG, JPEG or other image formats.

The following code sample shows how to convert Visio VSDX to PNG image in Node.js.

Export Visio Diagrams to SVG in Node.js

You can also convert a Visio diagram to SVG format in a couple of lines of code. The following are steps to perform this conversion.

The following code sample shows how to convert Visio VSDX to SVG format in Node.js.

Convert Visio Diagram to HTML in Node.js

Aspose.Diagram also allows you to convert the Visio diagram into an HTML document. In Visio to HTML conversion, the API also generates a sidebar to navigate between the pages of the diagram. The following are the steps to perform this conversion.

The following code sample shows how to convert Visio VSDX to HTML in Node.js.

Visio to HTML

Visio to HTML Node.js

Convert Visio to XAML in Node.js

You can also convert a Visio diagram to XAML format created using Microsoft’s markup language which is named the same, XAML (Extensible Application Markup Language). The following are the steps to convert a Visio diagram to XAML format.

The following code sample shows how to convert Visio VSDX to XAML in Node.js.

Conclusion

In this article, we have seen how to convert MS Visio diagrams to various popular formats in Node.js applications. The conversion scenarios we have covered in this article include Visio to PDF, Visio to images (PNG, JPEG, etc.), Visio to SVG, Visio to HTML, and Visio to XAML. You can learn more about the Node.js Visio API from the documentation.

Related Article