Convert VSDX to PDF in Node.js

Convert VSDX to PDF in Node.js

Aspose.Diagram offers a set of provisions to manipulate Microsoft Visio diagrams. It let’s you automate the processes of updating, exporting, and creating Visio diagrams in Node.js-based applications. Aspose.Diagram for Node.js library provides features to convert Visio files to other popular file formats such as PDF, PNG, and more. In addition, you can export & print the diagrams in no time. However, in this blog post, we will demonstrate how to convert VSDX to PDF in Node.js application programmatically.

The following points will be covered in this article:

Convert VSDX to PDF and PNG using Node.js - Visio API installation

It is very easy to install this Node.js library in your Node.js project. Run the following command to enable this package:

npm install aspose.diagram --save

How to convert VSDX to PDF in Node.js

In this section, we will write a code snippet that will convert Visio diagram to PDF in Node.js app programmatically.

These are the steps to convert Visio files to PDF:

  1. Initialize the Diagram() constructor to load a VSDX file.
  2. Instantiate the PdfSaveOptions() object for access to various attributes of the PDF file.
  3. Invoke the setSplitMultiPages(true) method to define whether split diagram to multi-pages.
  4. Call the save(filename, format) method to save as PDF file.

Copy and paste the following code snippet into your file.

Convert VSDX to PDF in Node.js

Convert VSDX to PDF in Node.js

Node.js library to convert VSDX to PNG

Let’s explore the following steps to convert VSDX file to PNG file programmatically:

  1. Call the Diagram() constructor to load a VSDX file.
  2. Initialize a new instance of ImageSaveOptions(saveFormat) to specify additional options.
  3. You can specify the image resolution and brightness by calling setResolution(), setImageBrightness() methods.
  4. Invoke the save(filename, format) method to save the file in PNG format.

The following code snippet converts a Visio diagram to a PNG file.

Convert VSDX to PNG in Node.js

VSDX to PNG in Node.js

Get a Free License

You can select a free temporary license to use Aspose.Diagram for Node.js without evaluation limitations.

Summing up

We are ending this blog post here. We hope you have learned how to convert VSDX to PDF in Node.js programmatically. Moreover, we also have gone through the Aspose.Diagram for Node.js API that converts VSDX to PNG instantly. You can explore the documentation for further features. In addition, conholdate.com is continuously writing on new topics. Therefore, please stay connected for regular updates.

Ask a question

In case of any queries please feel free to write to us at the forum.

See Also