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
- How to convert VSDX to PDF in Node.js
- Node.js library to convert VSDX to PNG
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:
- Initialize the Diagram() constructor to load a VSDX file.
- Instantiate the PdfSaveOptions() object for access to various attributes of the PDF file.
- Invoke the setSplitMultiPages(true) method to define whether split diagram to multi-pages.
- Call the save(filename, format) method to save as PDF file.
Copy and paste the following code snippet into your file.
Node.js library to convert VSDX to PNG
Let’s explore the following steps to convert VSDX file to PNG file programmatically:
- Call the Diagram() constructor to load a VSDX file.
- Initialize a new instance of ImageSaveOptions(saveFormat) to specify additional options.
- You can specify the image resolution and brightness by calling setResolution(), setImageBrightness() methods.
- 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.
Get a Free License
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.