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, Print & Convert Visio Diagrams

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

What is Aspose.Diagram SDK for Node.js?

Aspose.Diagram for Node.js via Java caters specifically to developers who use Node.js, just like you. It allows you to perform various tasks such as creating, editing, viewing, managing, and modifying Microsoft Visio diagrams within your Node.js applications. This tool, a member of the Aspose.Diagram family, relies on a robust Java foundation to efficiently handle Visio files, eliminating the requirement for Microsoft Visio. Integrating this API into your Node.js apps is straightforward, as it seamlessly interacts with Java. Developers can now easily combine the powerful capabilities of Node.js with the robust diagram handling features of the Aspose.Diagram API. Moreover, Aspose.Diagram stands out for its backing of sophisticated rendering choices. This means you can export diagrams as top-notch images or print them straight from your Node.js app.

By using Aspose.Diagram for Node.js via Java, you gain access to a potent tool that can manage a variety of Visio file formats such as VSDX, VDX, VSDM, VSSX, VSSM, VSTX, VSTM, VTX, and VDX, among others. This extensive support ensures seamless compatibility with various Visio versions and file types, enabling software developers to effortlessly handle nearly any Visio file. Within the library, there are key features you should know about. You can craft new diagrams from the ground up, insert shapes, connectors, and text into a diagram, manage intricate diagram elements, and transform Visio diagrams into different formats like PDF, HTML, SVG, and various image types (PNG, JPEG, BMP). With this tool, developers can display their diagrams in various ways for presentations, reports, or web apps. Companies can utilize the API to create Visio diagrams on the fly as a component of their reporting setups. All in all, Aspose.Diagram for Node.js through Java is a robust resource that streamlines diagram editing and boosts efficiency for developers dealing 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