<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-diagram-cloud</artifactId>
<version>20.3</version>
</dependency>
compile(group: 'com.aspose', name: 'aspose-diagram-cloud', version: '20.3')
<dependency org="com.aspose" name="aspose-diagram-cloud" rev="20.3">
<artifact name="aspose-diagram-cloud" ext="jar"/>
</dependency>
libraryDependencies += "com.aspose" % "aspose-diagram-cloud" % "20.3"
Create & Manage Visio® Diagrams with Java Cloud REST API
Aspose.Diagram Cloud SDK for Java enables developers to create, convert, and manage Microsoft Visio® diagrams directly within their Java applications, without requiring Microsoft Visio® to be installed. The SDK supports multiple diagram file formats, including VSDX, VDX, PDF, and others, ensuring seamless integration with cloud services and REST APIs. Java developers can upload, download, and manipulate diagrams across different platforms, including web, desktop, and mobile. With OAuth authentication, this SDK ensures secure and reliable diagram processing in the cloud. Perfect for Java developers looking to handle Visio® diagrams in their cloud-based applications.
Convert Diagram File
Convert Format
Convert Visio diagram files to different formats using the endpoint
/diagram/{name}/SaveAs
.
Save Options
Convert diagrams to popular formats like PDF and receive a link to the saved file.
Get Diagram Information
Retrieve Info
Extract diagram details such as page names and shapes through
/diagram/{name}
.
Upload Diagram File
Upload to Cloud
Upload a Visio diagram file to Cloud Storage with
/diagram/{name}/upload
.
Create Diagram File
Create New
Generate a new empty diagram file in a specified format using
/diagram/{name}
.
Manage Files and Storage
Download File
Download files from Cloud Storage via
/diagram/storage/file/{path}
.
Upload File
Upload files to Cloud Storage using
/diagram/storage/file/{path}
.
Copy File
Copy files to a new location in Cloud Storage using
/diagram/storage/file/copy/{srcPath}
.
Move File
Move files across Cloud Storage using
/diagram/storage/file/move/{srcPath}
.
Delete File
Remove files from Cloud Storage using
/diagram/storage/file/{path}
.
Supported File Formats
Format | Description | Load | Save |
---|---|---|---|
VSDX | Microsoft Visio Drawing that uses OPC (Open Packaging Conventions) | ✔️ | ✔️ |
VDX | Drawing or chart created with Microsoft Visio | ✔️ | ✔️ |
VSD | Visio Drawing (Vector Graphics File Format) | ✔️ | |
VSX | Visio Stencil XML file type | ✔️ | ✔️ |
VTX | XML for Visio (Template File) | ✔️ | ✔️ |
VSSX | Visio Stencil file with objects for technical drawings | ✔️ | ✔️ |
VSTX | Microsoft Visio Drawing Template | ✔️ | ✔️ |
VSDM | Visio Macro-Enabled Drawing file type | ✔️ | ✔️ |
VSSM | Stores a collection of shapes | ✔️ | ✔️ |
VSTM | Visio Drawing Template with macros | ✔️ | ✔️ |
VDW | Visio Web Drawing File Type | ✔️ | |
VSS | Visio Stencil File Type | ✔️ | |
VST | VST Template File | ✔️ | |
Portable Document Format | ✔️ | ||
XPS | XML Paper Specification format | ✔️ | |
XAML | XML Application Markup Language | ✔️ | |
SWF | Adobe Flash File | ✔️ | |
SVG | Scalable Vector Graphics (XML-based vector image) | ✔️ | |
EMF | Enhanced MetaFile | ✔️ | |
JPEG | Joint Photographic Experts Group format | ✔️ | |
PNG | Portable Network Graphics format | ✔️ | |
BMP | Bitmap Image Format | ✔️ | |
TIFF | Single or Multi-Page TIFF Image | ✔️ | |
HTML | HyperText Markup Language | ✔️ |
Supported Platforms
Platform | Description |
---|---|
Java | Fully supported via REST API in Java applications. |
.NET | Supported through REST API in .NET applications. |
PHP | Accessible via REST API in PHP applications. |
Ruby | Available via REST API in Ruby applications. |
Python | Supported through REST API in Python applications. |
Node.js | Accessible via REST API in Node.js applications. |
Web | Usable in web-based platforms via REST API. |
Desktop | Compatible with desktop environments via REST API. |
Mobile | Supported on mobile platforms through REST API. |
Cloud | Works with various cloud platforms using REST API. |
Requirements
- Java 1.7+
- Maven
Prerequisites
To use Aspose.Diagram Cloud SDK for Java, register an account with Aspose Cloud and obtain your Client ID and Client Secret from the Cloud Dashboard. A free quota is available; see Aspose Cloud Pricing for details.
Installation
Install from Maven
Add the Aspose Cloud repository to your application’s pom.xml
:
<repositories>
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://releases.aspose.cloud/java/repo/</url>
</repository>
</repositories>
Install from Source
To install the API client library locally:
mvn clean install
To deploy it to a remote Maven repository, configure your repository settings and run:
mvn clean deploy
Maven Users
Add this dependency to your project’s pom.xml
:
<dependencies>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-diagram-cloud</artifactId>
<version>20.3</version>
</dependency>
</dependencies>
Others
Generate the JAR by executing:
mvn clean package
Then manually install the following JARs:
target/aspose-diagram-cloud-20.3.jar
target/lib/*.jar
Authorization & Authentication
The SDK uses JWT for authentication:
- Type: OAuth
- Flow: application
- Authorization URL:
https://api.aspose.cloud/connect/token
Recommendation
In a multithreaded environment, create an instance of ApiClient
per thread to avoid potential issues.
Convert Microsoft Visio (VDX) to PDF
Learn how to convert a Visio diagram (VDX) file to a PDF format with Aspose.Diagram Cloud SDK for Java. This example provides a simple way to use REST APIs to convert VDX files to high-quality PDFs for easy sharing and archiving.
import com.aspose.cloud.diagram.api.DiagramApi;
import com.aspose.cloud.diagram.model.PdfSaveOptions;
import com.aspose.cloud.diagram.model.SaveOptionsRequest;
import com.aspose.cloud.diagram.model.SaveAsResponse;
public class ConvertVDXToPDF {
public static void main(String[] args) {
try {
// Initialize the DiagramApi with credentials (get Client ID and Secret from https://dashboard.aspose.cloud)
DiagramApi diagramApi = new DiagramApi("client_credentials", "YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
// Define the input file name and output folder
String fileName = "sample.vdx";
String folder = "output_folder";
// Set up save options to convert to PDF
SaveOptionsRequest request = new SaveOptionsRequest();
request.setFileName("output.pdf");
request.setFolder(folder);
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setIsExportComments(true);
saveOptions.setJpegQuality(100);
request.setSaveOptions(saveOptions);
// Convert VDX to PDF
SaveAsResponse response = diagramApi.saveAs(fileName, request, folder, true);
System.out.println("PDF File Saved: " + response.getSavedFile());
} catch (Exception e) {
System.err.println("Error occurred: " + e.getMessage());
}
}
}
Convert Microsoft Visio (VDX) to PNG
Convert a Visio diagram (VDX) to a PNG image using Aspose.Diagram Cloud SDK for Java. This example demonstrates how to use cloud-based REST APIs to generate PNG images from Visio files.
import com.aspose.cloud.diagram.api.DiagramApi;
import com.aspose.cloud.diagram.model.ImageSaveOptions;
import com.aspose.cloud.diagram.model.SaveOptionsRequest;
import com.aspose.cloud.diagram.model.SaveAsResponse;
public class ConvertVDXToPNG {
public static void main(String[] args) {
try {
// Initialize the DiagramApi
DiagramApi diagramApi = new DiagramApi("client_credentials", "YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
// Define the input file and folder
String fileName = "sample.vdx";
String folder = "output_folder";
// Set up save options to convert to PNG
SaveOptionsRequest request = new SaveOptionsRequest();
request.setFileName("output.png");
request.setFolder(folder);
ImageSaveOptions saveOptions = new ImageSaveOptions();
saveOptions.setIsExportComments(true);
saveOptions.setJpegQuality(100);
request.setSaveOptions(saveOptions);
// Convert VDX to PNG
SaveAsResponse response = diagramApi.saveAs(fileName, request, folder, true);
System.out.println("PNG File Saved: " + response.getSavedFile());
} catch (Exception e) {
System.err.println("Error occurred: " + e.getMessage());
}
}
}
Create a New Microsoft Visio (VDX) Diagram
Learn how to create a new Microsoft Visio (VDX) diagram from scratch using Aspose.Diagram Cloud SDK for Java. This example guides you through creating a new diagram file in the cloud.
import com.aspose.cloud.diagram.api.DiagramApi;
import com.aspose.cloud.diagram.model.CreateNewResponse;
public class CreateVDXDiagram {
public static void main(String[] args) {
try {
// Initialize the DiagramApi with credentials
DiagramApi diagramApi = new DiagramApi("client_credentials", "YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
// Define the new diagram name and folder
String newDiagramName = "newDiagram.vdx";
String folder = "output_folder";
// Create a new VDX diagram
CreateNewResponse response = diagramApi.createNew(newDiagramName, folder, true);
System.out.println("New Diagram Created: " + response.getCreated());
} catch (Exception e) {
System.err.println("Error occurred: " + e.getMessage());
}
}
}
Convert Microsoft Visio (VDX) to SVG
This example demonstrates how to convert a Visio (VDX) file to SVG format using Aspose.Diagram Cloud SDK for Java, ideal for scalable vector graphics output.
import com.aspose.cloud.diagram.api.DiagramApi;
import com.aspose.cloud.diagram.model.SVGSaveOptions;
import com.aspose.cloud.diagram.model.SaveOptionsRequest;
import com.aspose.cloud.diagram.model.SaveAsResponse;
public class ConvertVDXToSVG {
public static void main(String[] args) {
try {
// Initialize the DiagramApi with credentials
DiagramApi diagramApi = new DiagramApi("client_credentials", "YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
// Define the input file and folder
String fileName = "sample.vdx";
String folder = "output_folder";
// Set up save options to convert to SVG
SaveOptionsRequest request = new SaveOptionsRequest();
request.setFileName("output.svg");
request.setFolder(folder);
SVGSaveOptions saveOptions = new SVGSaveOptions();
saveOptions.setQuality(100);
request.setSaveOptions(saveOptions);
// Convert VDX to SVG
SaveAsResponse response = diagramApi.saveAs(fileName, request, folder, true);
System.out.println("SVG File Saved: " + response.getSavedFile());
} catch (Exception e) {
System.err.println("Error occurred: " + e.getMessage());
}
}
}
Aspose.Diagram Cloud SKDs
GitHub
Package Manager
Aspose.Diagram Aspose.Diagram Cloud Aspose Java REST API Maven SDK Java SDK Cloud REST REST API Cloud API MIT JWT oauth Aspose.Total Cloud VSDX VSX VTX VDX VSSX VSTX VSDM VSSM VSTM VDW VSD VSS VST PDF PDF/A XPS JPEG PNG BMP TIFF SVG EMF HTML XAML SWF create view convert converter conversion export exporter Visio drawing sketch flowchart image raster fixed-layout