1. Products
  2.   Diagram
  3.   Node.js
  4.   Aspose.Diagram for Node.js via Java

Aspose.Diagram for Node.js via Java

 
 

Node.js API to Create, Read & Convert Visio Diagrams

Leading Node.js Library that enables Developers to Create, Edit, Read, Manipulate and Convert Microsoft Visio Diagrams to PDF, HTML, XPS & Images File Formats inside Node.js Environment.

Aspose.Diagram for Node.js via Java is a special tool made for software developers like you who work with Node.js. It lets you create, edit, view, manage, and change Microsoft Visio diagrams in your Node.js apps. This tool is part of the Aspose.Diagram family and uses a strong Java core to handle Visio files smoothly and effectively, even without needing Microsoft Visio. You can easily add this API to your Node.js apps, as it works seamlessly with Java. This compatibility allows developers to leverage the rich ecosystem of Node.js while benefiting from the robust diagram handling capabilities of the Aspose.Diagram API.

Aspose.Diagram for Node.js via Java is a powerful tool that can handle various Visio file formats like VSDX, VDX, VSDM, VSSX, VSSM, VSTX, VSTM, VTX, VDX, and more. This wide support means it works well with different Visio versions and file types, making it easy for software developers to work with almost any Visio file. The library comes with key features like creating new diagrams from the ground up, adding shapes, connectors, and text to a diagram, advanced diagram elements handling and converting Visio diagrams to formats such as PDF, HTML, SVG, and various image formats (PNG, JPEG, BMP).

One great thing about Aspose.Diagram is its ability to offer advanced rendering features. For instance, you can export diagrams to top-notch images or print them right from your Node.js app. This lets you display your diagrams in various ways like in presentations, reports, or on the web. Companies can also use the API to create Visio diagrams in real-time for their reports. All in all, Aspose.Diagram for Node.js via Java is a powerful tool that simplifies diagram manipulation and enhances productivity for developers working with Microsoft Visio diagrams.

Previous Next

Getting Started with Aspose.Diagram for Node.js via Java

The recommend way to install Aspose.Diagram for Node.js via Java is using NPM. Please use the following command for a smooth installation.

Install Aspose.Diagram for Node.js via Java via npm

npm install aspose.diagram

You can download the library directly from Aspose.Diagram product page

Diagram Creation and Manipulation

Aspose.Diagram for Node.js via Java makes it easy for software developers to create a new Visio diagrams from scratch inside Node.js applications. Software Developers can add and connect shapes, insert text and images to diagrams, define custom properties, and configure various diagram settings programmatically. This flexibility is crucial for automating diagram generation and modifications in large-scale applications. The following example shows, how software developers can create a new Visio diagram inside Node.js applications.

How to Create a New Visio Diagram inside Node.js Apps?

const aspose = require('aspose.diagram');

// Load license (if available)
const license = new aspose.License();
license.setLicense('Aspose.Diagram.Java.lic');

// Initialize a new Diagram
const diagram = new aspose.Diagram();

// Add a new rectangle shape
const shapeId = diagram.addShape(4.25, 5.5, 2, 1, aspose.ShapeType.Rectangle);
const shape = diagram.getShape(shapeId);
shape.getText().getValue().add(new aspose.Txt('Hello World'));

// Save the diagram
diagram.save('output.vsdx', aspose.SaveFileFormat.VSDX);

Visio Diagrams Conversion to Other Formats in Node.js

One of the standout features of Aspose.Diagram for Node.js via Java is its ability to convert Visio diagrams to different formats such as PDF, XPS, HTML, EMF, SVG, and image formats like PNG, JPEG, BMP and many more. This functionality is vital for sharing diagrams in a more accessible format or integrating them into various workflows. The following example demonstrates how software developers to can load and convert an existing diagram to PDF file formats inside Node.js via java API.

How to Convert an Existing Visio Diagram to PDF inside Node.js Apps?

// Load an existing diagram
const diagram = new aspose.Diagram('input.vsdx');

// Save as PDF
diagram.save('output.pdf', aspose.SaveFileFormat.PDF);

Advanced Diagram Elements Handling

Aspose.Diagram for Node.js via Java allows software developers to manipulate advanced diagram elements such as layers, masters, pages, shapes, and connectors inside their own Node.js applications. The API provides detailed control over these components, enabling intricate diagram customizations and adjustments. The following example shows how to software developers can connect shapes using the connector inside Node.js applications.

How to Use Connector to Connect Shapes inside Visio Diagrams?

// Create a new connector shape
const connectorId = diagram.addShape(1, 2, 1, 1, aspose.ShapeType.DynamicConnector);
const connector = diagram.getShape(connectorId);

// Connect the shapes
connector.connect(1, shapeId, 2, shapeId);

// Save the diagram
diagram.save('output_with_connector.vsdx', aspose.SaveFileFormat.VSDX);	

Printing Visio Diagrams via Node.js API

Aspose.Diagram for Node.js via Java is a versatile API that enables software developers to work with Microsoft Visio diagrams within Node.js applications. One of the powerful features of this API is its ability to print Visio diagrams programmatically. To print a Visio diagram there are several important steps that you need to follow, such as Setting up the Environment, Loading the Visio Diagram, Configuring Print Settings and Printing the Diagram. The following code example shows how software developers can load and print an existing Visio diagram inside Node.js applications.

How to Load and Print an Existing Visio Diagram inside Node.js Environment?

const aspose = require('aspose.diagram');

// Load license (if available)
const license = new aspose.License();
license.setLicense('Aspose.Diagram.Java.lic');

// Load an existing Visio diagram
const diagram = new aspose.Diagram('path/to/diagram.vsdx');

// Create a PrinterSettings object
const printerSettings = new aspose.PrinterSettings();
printerSettings.setPrinterName('Default Printer');

// Configure page settings
const pageSettings = new aspose.PageSettings();
pageSettings.setOrientation(aspose.PageOrientation.Portrait);
pageSettings.setPaperSize(aspose.PaperSize.A4);

// Apply the page settings to the printer settings
printerSettings.setPageSettings(pageSettings);

// Create a PrintDocument object
const printDocument = new aspose.PrintDocument(diagram);

// Set the printer settings
printDocument.setPrinterSettings(printerSettings);

// Print the entire document
printDocument.print();

 English